// Generated by Qleany v1.5.0 from entity_dtos.tera

use common::entities::List;
pub use common::entities::ListStyle;
use common::types::EntityId;
use serde::{Deserialize, Serialize};
use std::convert::From;

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct ListDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub style: ListStyle,
    pub indent: i64,
    pub prefix: String,
    pub suffix: String,
}

impl From<ListDto> for List {
    fn from(dto: ListDto) -> Self {
        List {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            style: dto.style,
            indent: dto.indent,
            prefix: dto.prefix,
            suffix: dto.suffix,
        }
    }
}

impl From<&ListDto> for List {
    fn from(dto: &ListDto) -> Self {
        List {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            style: dto.style.clone(),
            indent: dto.indent,
            prefix: dto.prefix.clone(),
            suffix: dto.suffix.clone(),
        }
    }
}

impl From<List> for ListDto {
    fn from(entity: List) -> Self {
        ListDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            style: entity.style,
            indent: entity.indent,
            prefix: entity.prefix,
            suffix: entity.suffix,
        }
    }
}

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct CreateListDto {
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub style: ListStyle,
    pub indent: i64,
    pub prefix: String,
    pub suffix: String,
}

impl From<CreateListDto> for List {
    fn from(dto: CreateListDto) -> Self {
        List {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            style: dto.style,
            indent: dto.indent,
            prefix: dto.prefix,
            suffix: dto.suffix,
        }
    }
}

impl From<&CreateListDto> for List {
    fn from(dto: &CreateListDto) -> Self {
        List {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            style: dto.style.clone(),
            indent: dto.indent,
            prefix: dto.prefix.clone(),
            suffix: dto.suffix.clone(),
        }
    }
}

impl From<List> for CreateListDto {
    fn from(entity: List) -> Self {
        CreateListDto {
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            style: entity.style,
            indent: entity.indent,
            prefix: entity.prefix,
            suffix: entity.suffix,
        }
    }
}

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct UpdateListDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub style: ListStyle,
    pub indent: i64,
    pub prefix: String,
    pub suffix: String,
}

impl From<UpdateListDto> for List {
    fn from(dto: UpdateListDto) -> Self {
        List {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            style: dto.style,
            indent: dto.indent,
            prefix: dto.prefix,
            suffix: dto.suffix,
        }
    }
}

impl From<&UpdateListDto> for List {
    fn from(dto: &UpdateListDto) -> Self {
        List {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            style: dto.style.clone(),
            indent: dto.indent,
            prefix: dto.prefix.clone(),
            suffix: dto.suffix.clone(),
        }
    }
}

impl From<List> for UpdateListDto {
    fn from(entity: List) -> Self {
        UpdateListDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            style: entity.style,
            indent: entity.indent,
            prefix: entity.prefix,
            suffix: entity.suffix,
        }
    }
}

impl From<ListDto> for UpdateListDto {
    fn from(dto: ListDto) -> Self {
        UpdateListDto {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            style: dto.style,
            indent: dto.indent,
            prefix: dto.prefix,
            suffix: dto.suffix,
        }
    }
}
