//! `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 = "data")]
pub struct Model {
    pub created_at: DateTimeWithTimeZone,
    pub updated_at: DateTimeWithTimeZone,
    #[sea_orm(primary_key)]
    pub id: i32,
    pub file_url: String,
    pub protected: bool,
    pub file_name: String,
}

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

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

impl Related<super::projects::Entity> for Entity {
    fn to() -> RelationDef {
        super::project_thumbnails::Relation::Projects.def()
    }
    fn via() -> Option<RelationDef> {
        Some(super::project_thumbnails::Relation::Data.def().rev())
    }
}
