//! `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 = "groups")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    #[sea_orm(unique)]
    pub name: String,
}

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

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

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

impl ActiveModelBehavior for ActiveModel {}
