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

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

#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct WorkspaceDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub manifest_absolute_path: String,
    pub global: EntityId,
    pub entities: Vec<EntityId>,
    pub features: Vec<EntityId>,
    pub user_interface: EntityId,
}

impl From<WorkspaceDto> for Workspace {
    fn from(dto: WorkspaceDto) -> Self {
        Workspace {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            manifest_absolute_path: dto.manifest_absolute_path,
            global: dto.global,
            entities: dto.entities,
            features: dto.features,
            user_interface: dto.user_interface,
        }
    }
}

impl From<&WorkspaceDto> for Workspace {
    fn from(dto: &WorkspaceDto) -> Self {
        Workspace {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            manifest_absolute_path: dto.manifest_absolute_path.clone(),
            global: dto.global,
            entities: dto.entities.clone(),
            features: dto.features.clone(),
            user_interface: dto.user_interface,
        }
    }
}

impl From<Workspace> for WorkspaceDto {
    fn from(entity: Workspace) -> Self {
        WorkspaceDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            manifest_absolute_path: entity.manifest_absolute_path,
            global: entity.global,
            entities: entity.entities,
            features: entity.features,
            user_interface: entity.user_interface,
        }
    }
}

#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct CreateWorkspaceDto {
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub manifest_absolute_path: String,
    pub global: EntityId,
    pub entities: Vec<EntityId>,
    pub features: Vec<EntityId>,
    pub user_interface: EntityId,
}

impl From<CreateWorkspaceDto> for Workspace {
    fn from(dto: CreateWorkspaceDto) -> Self {
        Workspace {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            manifest_absolute_path: dto.manifest_absolute_path,
            global: dto.global,
            entities: dto.entities,
            features: dto.features,
            user_interface: dto.user_interface,
        }
    }
}

impl From<&CreateWorkspaceDto> for Workspace {
    fn from(dto: &CreateWorkspaceDto) -> Self {
        Workspace {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            manifest_absolute_path: dto.manifest_absolute_path.clone(),
            global: dto.global,
            entities: dto.entities.clone(),
            features: dto.features.clone(),
            user_interface: dto.user_interface,
        }
    }
}

impl From<Workspace> for CreateWorkspaceDto {
    fn from(entity: Workspace) -> Self {
        CreateWorkspaceDto {
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            manifest_absolute_path: entity.manifest_absolute_path,
            global: entity.global,
            entities: entity.entities,
            features: entity.features,
            user_interface: entity.user_interface,
        }
    }
}
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct UpdateWorkspaceDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub manifest_absolute_path: String,
}

impl From<UpdateWorkspaceDto> for Workspace {
    fn from(dto: UpdateWorkspaceDto) -> Self {
        Workspace {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            manifest_absolute_path: dto.manifest_absolute_path,
            global: Default::default(),
            entities: Default::default(),
            features: Default::default(),
            user_interface: Default::default(),
        }
    }
}

impl From<&UpdateWorkspaceDto> for Workspace {
    fn from(dto: &UpdateWorkspaceDto) -> Self {
        Workspace {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            manifest_absolute_path: dto.manifest_absolute_path.clone(),
            global: Default::default(),
            entities: Default::default(),
            features: Default::default(),
            user_interface: Default::default(),
        }
    }
}

impl From<Workspace> for UpdateWorkspaceDto {
    fn from(entity: Workspace) -> Self {
        UpdateWorkspaceDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            manifest_absolute_path: entity.manifest_absolute_path,
        }
    }
}

impl From<WorkspaceDto> for UpdateWorkspaceDto {
    fn from(dto: WorkspaceDto) -> Self {
        UpdateWorkspaceDto {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            manifest_absolute_path: dto.manifest_absolute_path,
        }
    }
}
pub use common::direct_access::workspace::WorkspaceRelationshipField;

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct WorkspaceRelationshipDto {
    pub id: EntityId,
    pub field: WorkspaceRelationshipField,
    pub right_ids: Vec<EntityId>,
}
