///|
pub(all) enum Rule {
  UndrivenSignal
  MultipleDrivers
  UnresolvedInstance
  DuplicateDeclaration
  OutputNotAssigned
  WidthMismatch
  ContractWidthMismatch
  UnknownContract
  ConditionalAssignment
} derive(Eq, Debug)

///|
pub fn Rule::code(self : Rule) -> String {
  match self {
    UndrivenSignal => "RTL201"
    MultipleDrivers => "RTL202"
    UnresolvedInstance => "RTL102"
    DuplicateDeclaration => "RTL101"
    OutputNotAssigned => "RTL203"
    WidthMismatch => "RTL204"
    ContractWidthMismatch => "RTL205"
    UnknownContract => "RTL206"
    ConditionalAssignment => "RTL207"
  }
}

///|
pub(all) struct LintConfig {
  disabled : Array[String]
  warnings_as_errors : Bool
} derive(Eq, Debug)

///|
pub fn default_config() -> LintConfig {
  { disabled: [], warnings_as_errors: false }
}

///|
fn LintConfig::enabled(self : LintConfig, code : String) -> Bool {
  !self.disabled.any(fn(value) { value == code })
}