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

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

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)]
#[sea_orm(table_name = "menu_sku")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    #[sea_orm(column_type = "Text", nullable)]
    pub sku_no: Option<String>,
    #[sea_orm(column_type = "Text", nullable)]
    pub logo: Option<String>,
    pub goods_id: i32,
    pub stock: i32,
    pub price: Decimal,
    pub line_price: Decimal,
    pub weight: Option<Decimal>,
    #[sea_orm(column_type = "Text")]
    pub status: String,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(has_many = "super::menu_sku_spec::Entity")]
    MenuSkuSpec,
}

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

impl Related<super::menu_spec::Entity> for Entity {
    fn to() -> RelationDef {
        super::menu_sku_spec::Relation::MenuSpec.def()
    }
    fn via() -> Option<RelationDef> {
        Some(super::menu_sku_spec::Relation::MenuSku.def().rev())
    }
}

impl ActiveModelBehavior for ActiveModel {}
