use crate::{AiSessionId, DateTimeUtc, ModelId, ModelVersionId, RoomId};
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "ai_session")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: AiSessionId,
    pub room: RoomId,
    pub model: ModelId,
    pub version: ModelVersionId,
    pub token_input: i64,
    pub token_output: i64,
    pub latency_ms: Option<i64>,
    pub cost: Option<f64>,
    pub currency: Option<String>,
    pub error_message: Option<String>,
    pub error_code: Option<String>,
    pub created_at: DateTimeUtc,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}
