//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.15

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

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "page")]
pub struct Model {
    #[sea_orm(primary_key)]
    pub id: i32,
    pub video_id: i32,
    pub cid: i64,
    pub pid: i32,
    pub name: String,
    pub width: Option<u32>,
    pub height: Option<u32>,
    pub duration: u32,
    pub path: Option<String>,
    pub image: Option<String>,
    pub download_status: u32,
    pub created_at: String,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
    #[sea_orm(
        belongs_to = "super::video::Entity",
        from = "Column::VideoId",
        to = "super::video::Column::Id"
    )]
    Video,
}

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

impl ActiveModelBehavior for ActiveModel {}
