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

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

#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct GlobalDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub language: String,
    pub application_name: String,
    pub organisation_name: String,
    pub organisation_domain: String,
    pub prefix_path: String,
}

impl From<GlobalDto> for Global {
    fn from(dto: GlobalDto) -> Self {
        Global {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            language: dto.language,
            application_name: dto.application_name,
            organisation_name: dto.organisation_name,
            organisation_domain: dto.organisation_domain,
            prefix_path: dto.prefix_path,
        }
    }
}

impl From<&GlobalDto> for Global {
    fn from(dto: &GlobalDto) -> Self {
        Global {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            language: dto.language.clone(),
            application_name: dto.application_name.clone(),
            organisation_name: dto.organisation_name.clone(),
            organisation_domain: dto.organisation_domain.clone(),
            prefix_path: dto.prefix_path.clone(),
        }
    }
}

impl From<Global> for GlobalDto {
    fn from(entity: Global) -> Self {
        GlobalDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            language: entity.language,
            application_name: entity.application_name,
            organisation_name: entity.organisation_name,
            organisation_domain: entity.organisation_domain,
            prefix_path: entity.prefix_path,
        }
    }
}

#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct CreateGlobalDto {
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub language: String,
    pub application_name: String,
    pub organisation_name: String,
    pub organisation_domain: String,
    pub prefix_path: String,
}

impl From<CreateGlobalDto> for Global {
    fn from(dto: CreateGlobalDto) -> Self {
        Global {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            language: dto.language,
            application_name: dto.application_name,
            organisation_name: dto.organisation_name,
            organisation_domain: dto.organisation_domain,
            prefix_path: dto.prefix_path,
        }
    }
}

impl From<&CreateGlobalDto> for Global {
    fn from(dto: &CreateGlobalDto) -> Self {
        Global {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            language: dto.language.clone(),
            application_name: dto.application_name.clone(),
            organisation_name: dto.organisation_name.clone(),
            organisation_domain: dto.organisation_domain.clone(),
            prefix_path: dto.prefix_path.clone(),
        }
    }
}

impl From<Global> for CreateGlobalDto {
    fn from(entity: Global) -> Self {
        CreateGlobalDto {
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            language: entity.language,
            application_name: entity.application_name,
            organisation_name: entity.organisation_name,
            organisation_domain: entity.organisation_domain,
            prefix_path: entity.prefix_path,
        }
    }
}
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct UpdateGlobalDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub language: String,
    pub application_name: String,
    pub organisation_name: String,
    pub organisation_domain: String,
    pub prefix_path: String,
}

impl From<UpdateGlobalDto> for Global {
    fn from(dto: UpdateGlobalDto) -> Self {
        Global {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            language: dto.language,
            application_name: dto.application_name,
            organisation_name: dto.organisation_name,
            organisation_domain: dto.organisation_domain,
            prefix_path: dto.prefix_path,
        }
    }
}

impl From<&UpdateGlobalDto> for Global {
    fn from(dto: &UpdateGlobalDto) -> Self {
        Global {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            language: dto.language.clone(),
            application_name: dto.application_name.clone(),
            organisation_name: dto.organisation_name.clone(),
            organisation_domain: dto.organisation_domain.clone(),
            prefix_path: dto.prefix_path.clone(),
        }
    }
}

impl From<Global> for UpdateGlobalDto {
    fn from(entity: Global) -> Self {
        UpdateGlobalDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            language: entity.language,
            application_name: entity.application_name,
            organisation_name: entity.organisation_name,
            organisation_domain: entity.organisation_domain,
            prefix_path: entity.prefix_path,
        }
    }
}

impl From<GlobalDto> for UpdateGlobalDto {
    fn from(dto: GlobalDto) -> Self {
        UpdateGlobalDto {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            language: dto.language,
            application_name: dto.application_name,
            organisation_name: dto.organisation_name,
            organisation_domain: dto.organisation_domain,
            prefix_path: dto.prefix_path,
        }
    }
}
