//! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.0

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

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "health_records")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    pub node_id: i32,
    pub status: String,
    pub response_time: i32,
    #[sea_orm(column_type = "Text")]
    pub error_message: String,
    pub checked_at: DateTimeWithTimeZone,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "super::shared_nodes::Entity",
        from = "Column::NodeId",
        to = "super::shared_nodes::Column::Id",
        on_update = "Cascade",
        on_delete = "Cascade"
    )]
    SharedNodes,
}

impl Related<super::shared_nodes::Entity> for Entity {
    fn to() -> RelationDef {
        Relation::SharedNodes.def()
    }
}

impl ActiveModelBehavior for ActiveModel {}
