//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15

use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[sea_orm(table_name = "note_file")]
#[cfg_attr(
    feature = "napi",
    napi_derive::napi(object, js_name = "NoteFile", use_nullable = true)
)]
pub struct Model {
    #[sea_orm(column_name = "serialNo", primary_key)]
    pub serial_no: i64,
    #[sea_orm(column_name = "noteId")]
    pub note_id: String,
    #[sea_orm(column_name = "fileId")]
    pub file_id: String,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "super::drive_file::Entity",
        from = "Column::FileId",
        to = "super::drive_file::Column::Id",
        on_update = "NoAction",
        on_delete = "Cascade"
    )]
    DriveFile,
    #[sea_orm(
        belongs_to = "super::note::Entity",
        from = "Column::NoteId",
        to = "super::note::Column::Id",
        on_update = "NoAction",
        on_delete = "Cascade"
    )]
    Note,
}

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

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

impl ActiveModelBehavior for ActiveModel {}
