//! `SeaORM` Entity, manually maintained

use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "query_events")]
pub struct Model {
    pub created_at: DateTimeWithTimeZone,
    pub updated_at: DateTimeWithTimeZone,
    #[sea_orm(primary_key)]
    pub id: i32,
    pub event_type: String,
    #[sea_orm(column_type = "Text")]
    pub query_text: String,
    #[sea_orm(column_type = "Text")]
    pub normalized_query: String,
    pub request_path: Option<String>,
    pub referrer: Option<String>,
    #[sea_orm(column_type = "Text", nullable)]
    pub user_agent: Option<String>,
    pub result_count: Option<i32>,
    pub success: Option<bool>,
    pub response_mode: Option<String>,
    pub provider: Option<String>,
    pub chat_model: Option<String>,
    pub latency_ms: Option<i32>,
}

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

impl ActiveModelBehavior for ActiveModel {}
