use psdk_father::types::psdk_types::PsdkPrinterCommandEnumValue;

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Line {
  /**
   * 实线
   */
  SolidLine,
  /**
   * 虚线
   */
  DottedLine,
}

impl PsdkPrinterCommandEnumValue for Line {
  fn command_value(&self) -> String {
    match self {
      Line::SolidLine => 0.to_string(),
      Line::DottedLine => 1.to_string(),
    }
  }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum CodeType {
  Code128,
  Code39,
  Code93,
  Itf,
  Upca,
  Upce,
  Codabar,
  Ean8,
  Ean13,
  CodeITF,
  CodeUPCA,
  CodeUPCE,
  CodeCODABAR,
  CodeEAN8,
  CodeEAN13,
}

impl PsdkPrinterCommandEnumValue for CodeType {
  fn command_value(&self) -> String {
    match self {
      CodeType::Code128 => "128".to_string(),
      CodeType::Code39 => "39".to_string(),
      CodeType::Code93 => "93".to_string(),
      CodeType::Itf | CodeType::CodeITF => "ITF".to_string(),
      CodeType::Upca | CodeType::CodeUPCA => "UPCA".to_string(),
      CodeType::Upce | CodeType::CodeUPCE => "UPCE".to_string(),
      CodeType::Codabar | CodeType::CodeCODABAR => "CODABAR".to_string(),
      CodeType::Ean8 | CodeType::CodeEAN8 => "EAN8".to_string(),
      CodeType::Ean13 | CodeType::CodeEAN13 => "EAN13".to_string(),
    }
  }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ShowType {
  NoShow,
  ShowNone,
  ShowLeft,
  ShowCenter,
  ShowRight,
}

impl PsdkPrinterCommandEnumValue for ShowType {
  fn command_value(&self) -> String {
    match self {
      ShowType::NoShow | ShowType::ShowNone => 0.to_string(),
      ShowType::ShowLeft => 1.to_string(),
      ShowType::ShowCenter => 2.to_string(),
      ShowType::ShowRight => 3.to_string(),
    }
  }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Rotation {
  Rotation0,
  Rotation90,
  Rotation180,
  Rotation270,
}

impl PsdkPrinterCommandEnumValue for Rotation {
  fn command_value(&self) -> String {
    match self {
      Rotation::Rotation0 => 0.to_string(),
      Rotation::Rotation90 => 90.to_string(),
      Rotation::Rotation180 => 180.to_string(),
      Rotation::Rotation270 => 270.to_string(),
    }
  }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Direction {
  UpOut,
  DownOut,
}

impl PsdkPrinterCommandEnumValue for Direction {
  fn command_value(&self) -> String {
    match self {
      Direction::UpOut => 0.to_string(),
      Direction::DownOut => 1.to_string(),
    }
  }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum LineM {
  SolidLine,
  DottedLineM1,
  DottedLineM2,
  DottedLineM3,
  DottedLineM4,
}

impl PsdkPrinterCommandEnumValue for LineM {
  fn command_value(&self) -> String {
    match self {
      LineM::SolidLine => "".to_string(),
      LineM::DottedLineM1 => "M1".to_string(),
      LineM::DottedLineM2 => "M2".to_string(),
      LineM::DottedLineM3 => "M3".to_string(),
      LineM::DottedLineM4 => "M4".to_string(),
    }
  }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ECCLevel {
  L,
  M,
  Q,
  H,
  LevelL,
  LevelM,
  LevelQ,
  LevelH,
}

impl PsdkPrinterCommandEnumValue for ECCLevel {
  fn command_value(&self) -> String {
    match self {
      ECCLevel::L | ECCLevel::LevelL => "L".to_string(),
      ECCLevel::M | ECCLevel::LevelM => "M".to_string(),
      ECCLevel::Q | ECCLevel::LevelQ => "Q".to_string(),
      ECCLevel::H | ECCLevel::LevelH => "H".to_string(),
    }
  }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Font {
  Tss12,
  Tss16,
  Tss20,
  Tss24,
  Tss28,
  Tss32,
  TSS12,
  TSS16,
  TSS20,
  TSS24,
  TSS28,
  TSS32,
}

impl PsdkPrinterCommandEnumValue for Font {
  fn command_value(&self) -> String {
    match self {
      Font::Tss12 | Font::TSS12 => "TSS12.BF2".to_string(),
      Font::Tss16 | Font::TSS16 => "TSS16.BF2".to_string(),
      Font::Tss20 | Font::TSS20 => "TSS20.BF2".to_string(),
      Font::Tss24 | Font::TSS24 => "TSS24.BF2".to_string(),
      Font::Tss28 | Font::TSS28 => "TSS28.BF2".to_string(),
      Font::Tss32 | Font::TSS32 => "TSS32.BF2".to_string(),
    }
  }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Alignment {
  Default,
  Left,
  Center,
  Right,
}

impl PsdkPrinterCommandEnumValue for Alignment {
  fn command_value(&self) -> String {
    match self {
      Alignment::Default => 0.to_string(),
      Alignment::Left => 1.to_string(),
      Alignment::Center => 2.to_string(),
      Alignment::Right => 3.to_string(),
    }
  }
}

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum TImageMode {
  Overwrite,
  Or,
  Xor,
}

impl PsdkPrinterCommandEnumValue for TImageMode {
  fn command_value(&self) -> String {
    match self {
      TImageMode::Overwrite => 0.to_string(),
      TImageMode::Or => 1.to_string(),
      TImageMode::Xor => 2.to_string(),
    }
  }
}
