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

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "ai_tool_auth")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub session: AiSessionId,
    #[sea_orm(primary_key)]
    pub tool_call_id: String,
    pub method: String,
    pub arguments: String,
    pub decision: bool,
    pub reason: String,
    pub decision_by: UserId,
    pub decision_comment: Option<String>,
    pub logs: sea_orm::JsonValue,
    pub expires_at: Option<DateTimeUtc>,
    pub authorized_at: Option<DateTimeUtc>,
    pub created_at: DateTimeUtc,
    pub updated_at: DateTimeUtc,
}

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

impl ActiveModelBehavior for ActiveModel {}
