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

use super::CapabilityType;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "ai_model_capability")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i64,
    pub model_version_id: i64,
    pub capability: String,
    pub is_supported: bool,
    pub created_at: DateTimeUtc,
}

impl Model {
    pub fn capability_enum(&self) -> Result<CapabilityType, &'static str> {
        self.capability.parse()
    }
}

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

impl ActiveModelBehavior for ActiveModel {}
