//! `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 = "store_table")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    pub area_id: i32,
    #[sea_orm(column_type = "Text")]
    pub table_no: String,
    pub capacity: Option<i32>,
    #[sea_orm(column_type = "custom(\"DATETIME\")", nullable)]
    pub create_time: Option<String>,
    #[sea_orm(column_type = "custom(\"DATETIME\")", nullable)]
    pub update_time: Option<String>,
    pub status: Option<i32>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "super::store_area::Entity",
        from = "Column::AreaId",
        to = "super::store_area::Column::Id",
        on_update = "NoAction",
        on_delete = "NoAction"
    )]
    StoreArea,
}

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

impl ActiveModelBehavior for ActiveModel {}
