//! SeaORM Entity. Generated by sea-orm-codegen 0.1.0

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

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(schema_name = "schema_name", table_name = "rust_keyword")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    pub testing: i8,
    pub rust: u8,
    pub keywords: i16,
    pub r#type: u16,
    pub r#typeof: i32,
    pub crate_: u32,
    pub self_: i64,
    pub self_id1: u64,
    pub self_id2: i32,
    pub fruit_id1: i32,
    pub fruit_id2: i32,
    pub cake_id: i32,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "Entity",
        from = "Column::SelfId1",
        to = "Column::Id",
    )]
    SelfRef1,
    #[sea_orm(
        belongs_to = "Entity",
        from = "Column::SelfId2",
        to = "Column::Id",
    )]
    SelfRef2,
    #[sea_orm(
        belongs_to = "super::fruit::Entity",
        from = "Column::FruitId1",
        to = "super::fruit::Column::Id",
    )]
    Fruit1,
    #[sea_orm(
        belongs_to = "super::fruit::Entity",
        from = "Column::FruitId2",
        to = "super::fruit::Column::Id",
    )]
    Fruit2,
    #[sea_orm(
        belongs_to = "super::cake::Entity",
        from = "Column::CakeId",
        to = "super::cake::Column::Id",
    )]
    Cake,
}

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

impl ActiveModelBehavior for ActiveModel {}
