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

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

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "discount_profiles")]
pub struct Model {
    pub created_at: DateTimeWithTimeZone,
    pub updated_at: DateTimeWithTimeZone,
    #[sea_orm(primary_key)]
    pub id: i32,
    pub name: String,
    pub percent_bp: i32,
    pub scope_type: String,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(has_many = "super::account_discount_profiles::Entity")]
    AccountDiscountProfiles,
    #[sea_orm(has_many = "super::account_product_resolutions::Entity")]
    AccountProductResolutions,
    #[sea_orm(has_many = "super::audience_discount_profiles::Entity")]
    AudienceDiscountProfiles,
    #[sea_orm(has_many = "super::discount_profile_products::Entity")]
    DiscountProfileProducts,
}

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

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

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

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