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

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

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
#[sea_orm(table_name = "audio_tags")]
pub struct Model {
    #[sea_orm(primary_key, auto_increment = false)]
    pub id: Uuid,
    #[sea_orm(unique)]
    pub name: String,
    #[sea_orm(unique)]
    pub slug: String,
    pub created_at: DateTimeWithTimeZone,
}

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

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

impl Related<super::audio_tracks::Entity> for Entity {
    fn to() -> RelationDef {
        super::audio_track_tags::Relation::AudioTracks.def()
    }
    fn via() -> Option<RelationDef> {
        Some(super::audio_track_tags::Relation::AudioTags.def().rev())
    }
}
