use serde::{Deserialize, Serialize};
use tardis::basic::field::TrimString;
use tardis::chrono::{DateTime, Utc};
use tardis::db::sea_orm;
use tardis::web::poem_openapi;
use crate::rbum::rbum_enumeration::RbumScopeLevelKind;
#[derive(Serialize, Deserialize, Debug, poem_openapi::Object)]
pub struct RbumDomainAddReq {
#[oai(validator(min_length = "2", max_length = "255"))]
pub code: TrimString,
#[oai(validator(min_length = "2", max_length = "255"))]
pub name: TrimString,
#[oai(validator(min_length = "2", max_length = "2000"))]
pub note: Option<String>,
#[oai(validator(min_length = "2", max_length = "1000"))]
pub icon: Option<String>,
pub sort: Option<i64>,
pub scope_level: Option<RbumScopeLevelKind>,
}
#[derive(Serialize, Deserialize, Debug, poem_openapi::Object)]
pub struct RbumDomainModifyReq {
#[oai(validator(min_length = "2", max_length = "255"))]
pub name: Option<TrimString>,
#[oai(validator(min_length = "2", max_length = "2000"))]
pub note: Option<String>,
#[oai(validator(min_length = "2", max_length = "1000"))]
pub icon: Option<String>,
pub sort: Option<i64>,
pub scope_level: Option<RbumScopeLevelKind>,
}
#[derive(Serialize, Deserialize, Debug, Clone, poem_openapi::Object, sea_orm::FromQueryResult)]
pub struct RbumDomainSummaryResp {
pub id: String,
pub code: String,
pub name: String,
pub icon: String,
pub sort: i64,
pub own_paths: String,
pub owner: String,
pub create_time: DateTime<Utc>,
pub update_time: DateTime<Utc>,
pub scope_level: RbumScopeLevelKind,
}
#[derive(Serialize, Deserialize, Debug, poem_openapi::Object, sea_orm::FromQueryResult)]
pub struct RbumDomainDetailResp {
pub id: String,
pub code: String,
pub name: String,
pub note: String,
pub icon: String,
pub sort: i64,
pub own_paths: String,
pub owner: String,
pub owner_name: Option<String>,
pub create_time: DateTime<Utc>,
pub update_time: DateTime<Utc>,
pub scope_level: RbumScopeLevelKind,
}