use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CleanConfig {
  pub strip_utms: bool,
  pub fix_quotes: bool,
  pub fix_newlines: bool,
  pub play_sound: bool,
  pub autostart: bool,
  pub hotkey: String,
  #[serde(default)]
  pub custom_params: Vec<String>,
}

impl Default for CleanConfig {
  fn default() -> Self {
    Self {
      strip_utms: true,
      fix_quotes: true,
      fix_newlines: true,
      play_sound: true,
      autostart: false,
      hotkey: "Alt+Shift+C".to_string(),
      custom_params: vec![],
    }
  }
}

#[derive(Debug, Clone, Deserialize)]
pub struct Profile {
  pub activation_url: String,
  pub public_key_hex: String,
  #[serde(default)]
  pub deprecated_public_keys: Vec<String>,
}

#[derive(Debug, Clone, Deserialize)]
pub struct LicensingProfiles {
  pub development: Profile,
  pub testing: Profile,
  pub production: Profile,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LicensePayload {
  pub product_id: String,
  pub license_key: String,
  pub hwid: String,
  #[serde(skip_serializing_if = "Option::is_none")]
  pub max_devices: Option<u32>,
  #[serde(skip_serializing_if = "Option::is_none")]
  pub expires_at: Option<String>,
  #[serde(skip_serializing_if = "Option::is_none")]
  pub device_count: Option<u32>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct LicenseCapabilities {
  pub device_limit: Option<u32>,
  pub expires_at: Option<String>,
  pub is_active: bool,
}
