use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, PartialEq)]
pub enum ServiceStatus {
    Active,
    Degraded,
    Maintenance,
}

#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum ServiceRole {
    DataProvider,
    ReportGenerator,
    Persistence,
    Gateway,
    Other,
}

#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ServiceRegistration {
    /// Unique ID for this service instance (e.g., "tushare-provider-uuid")
    pub service_id: String,
    /// Service type/name (e.g., "tushare")
    pub service_name: String,
    /// The role/category of the service
    pub role: ServiceRole,
    /// Base URL for the service (e.g., "http://10.0.1.5:8000")
    pub base_url: String,
    /// Health check endpoint
    pub health_check_url: String,
}

#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct Heartbeat {
    pub service_id: String,
    pub status: ServiceStatus,
}

