use std::collections::BTreeMap;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct TranslationUnit {
pub key: String,
pub source_text: String,
pub target_locale: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub comment: Option<String>,
pub format_specifiers: Vec<String>,
pub has_plurals: bool,
pub has_substitutions: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct CompletedTranslation {
pub key: String,
pub locale: String,
pub value: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub plural_forms: Option<BTreeMap<String, String>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub substitution_name: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct FileSummary {
pub source_language: String,
pub total_keys: usize,
pub translatable_keys: usize,
pub locales: Vec<String>,
pub keys_by_state: BTreeMap<String, usize>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct SubmitResult {
pub accepted: usize,
pub rejected: Vec<RejectedTranslation>,
pub dry_run: bool,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub accepted_keys: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct RejectedTranslation {
pub key: String,
pub reason: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct LocaleCoverage {
pub locale: String,
pub total_keys: usize,
pub translatable_keys: usize,
pub translated: usize,
pub percentage: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct CoverageReport {
pub source_language: String,
pub total_keys: usize,
pub translatable_keys: usize,
pub locales: Vec<LocaleCoverage>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ValidationReport {
pub locale: String,
pub errors: Vec<ValidationIssue>,
pub warnings: Vec<ValidationIssue>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ValidationIssue {
pub key: String,
pub issue_type: String,
pub message: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct LocaleInfo {
pub locale: String,
pub translated: usize,
pub total: usize,
pub percentage: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct PluralUnit {
pub key: String,
pub source_text: String,
pub target_locale: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub comment: Option<String>,
pub format_specifiers: Vec<String>,
pub required_forms: Vec<String>,
pub source_forms: BTreeMap<String, String>,
pub existing_translations: BTreeMap<String, String>,
pub has_substitutions: bool,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub device_forms: Vec<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ContextKey {
pub key: String,
pub source_text: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub translated_text: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct DiffReport {
pub added: Vec<String>,
pub removed: Vec<String>,
pub modified: Vec<ModifiedKey>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ModifiedKey {
pub key: String,
pub old_value: String,
pub new_value: String,
}