use serde::{Deserialize, Serialize};

/// Brief info about a tender's companies.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CompanyBrief {
    pub ids: Vec<String>,
    pub names: Vec<String>,
}

/// A tender record from search results.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TenderRecord {
    pub date: String,
    pub filename: String,
    pub job_number: String,
    pub unit_id: String,
    pub unit_name: String,
    pub title: String,
    pub tender_type: String,
    pub companies: CompanyBrief,
    pub url: String,
    pub tender_api_url: String,
}

/// Search result with pagination.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SearchResult {
    pub query: String,
    pub page: u32,
    pub total_records: u64,
    pub total_pages: u32,
    pub records: Vec<TenderRecord>,
}

/// Government unit/agency.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Unit {
    pub unit_id: String,
    pub name: String,
    pub url: String,
}

/// API info response.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PccInfo {
    pub latest_date: String,
    pub oldest_date: String,
    pub total_records: u64,
}

/// Special budget entry.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SpecialBudget {
    pub name: String,
    pub search_api_url: String,
}
