use crate::error::domains::AnvilZksyncCode;
use crate::error::domains::CompilerCode;
use crate::error::domains::CoreCode;
use crate::error::domains::FoundryCode;
use crate::error::domains::HardhatCode;
use strum_macros::EnumDiscriminants;
use strum_macros::FromRepr;
#[derive(
Clone, Debug, EnumDiscriminants, Eq, PartialEq, serde :: Deserialize, serde :: Serialize,
)]
#[strum_discriminants(name(DomainCode))]
#[strum_discriminants(derive(FromRepr))]
#[strum_discriminants(vis(pub))]
#[repr(u32)]
pub enum Kind {
AnvilZksync(AnvilZksyncCode) = 5u32,
Compiler(CompilerCode) = 2u32,
Core(CoreCode) = 1u32,
Foundry(FoundryCode) = 4u32,
Hardhat(HardhatCode) = 3u32,
}
impl Kind {
pub fn domain_code(&self) -> u32 {
let domain: DomainCode = self.clone().into();
domain as u32
}
pub fn component_code(&self) -> u32 {
match self {
Kind::AnvilZksync(component) => *component as u32,
Kind::Compiler(component) => *component as u32,
Kind::Core(component) => *component as u32,
Kind::Foundry(component) => *component as u32,
Kind::Hardhat(component) => *component as u32,
}
}
}