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

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

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct FrameDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub parent_frame: Option<EntityId>,
    pub blocks: Vec<EntityId>,
    pub child_order: Vec<i64>,
    pub fmt_height: Option<i64>,
    pub fmt_width: Option<i64>,
    pub fmt_top_margin: Option<i64>,
    pub fmt_bottom_margin: Option<i64>,
    pub fmt_left_margin: Option<i64>,
    pub fmt_right_margin: Option<i64>,
    pub fmt_padding: Option<i64>,
    pub fmt_border: Option<i64>,
    pub fmt_position: Option<FramePosition>,
    pub fmt_is_blockquote: Option<bool>,
    pub table: Option<EntityId>,
}

impl From<FrameDto> for Frame {
    fn from(dto: FrameDto) -> Self {
        Frame {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            parent_frame: dto.parent_frame,
            blocks: dto.blocks,
            child_order: dto.child_order,
            fmt_height: dto.fmt_height,
            fmt_width: dto.fmt_width,
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_padding: dto.fmt_padding,
            fmt_border: dto.fmt_border,
            fmt_position: dto.fmt_position,
            fmt_is_blockquote: dto.fmt_is_blockquote,
            table: dto.table,
            byte_range: (0, 0),
        }
    }
}

impl From<&FrameDto> for Frame {
    fn from(dto: &FrameDto) -> Self {
        Frame {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            parent_frame: dto.parent_frame,
            blocks: dto.blocks.clone(),
            child_order: dto.child_order.clone(),
            fmt_height: dto.fmt_height,
            fmt_width: dto.fmt_width,
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_padding: dto.fmt_padding,
            fmt_border: dto.fmt_border,
            fmt_position: dto.fmt_position.clone(),
            fmt_is_blockquote: dto.fmt_is_blockquote,
            table: dto.table,
            byte_range: (0, 0),
        }
    }
}

impl From<Frame> for FrameDto {
    fn from(entity: Frame) -> Self {
        FrameDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            parent_frame: entity.parent_frame,
            blocks: entity.blocks,
            child_order: entity.child_order,
            fmt_height: entity.fmt_height,
            fmt_width: entity.fmt_width,
            fmt_top_margin: entity.fmt_top_margin,
            fmt_bottom_margin: entity.fmt_bottom_margin,
            fmt_left_margin: entity.fmt_left_margin,
            fmt_right_margin: entity.fmt_right_margin,
            fmt_padding: entity.fmt_padding,
            fmt_border: entity.fmt_border,
            fmt_position: entity.fmt_position,
            fmt_is_blockquote: entity.fmt_is_blockquote,
            table: entity.table,
        }
    }
}

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct CreateFrameDto {
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub parent_frame: Option<EntityId>,
    pub blocks: Vec<EntityId>,
    pub child_order: Vec<i64>,
    pub fmt_height: Option<i64>,
    pub fmt_width: Option<i64>,
    pub fmt_top_margin: Option<i64>,
    pub fmt_bottom_margin: Option<i64>,
    pub fmt_left_margin: Option<i64>,
    pub fmt_right_margin: Option<i64>,
    pub fmt_padding: Option<i64>,
    pub fmt_border: Option<i64>,
    pub fmt_position: Option<FramePosition>,
    pub fmt_is_blockquote: Option<bool>,
    pub table: Option<EntityId>,
}

impl From<CreateFrameDto> for Frame {
    fn from(dto: CreateFrameDto) -> Self {
        Frame {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            parent_frame: dto.parent_frame,
            blocks: dto.blocks,
            child_order: dto.child_order,
            fmt_height: dto.fmt_height,
            fmt_width: dto.fmt_width,
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_padding: dto.fmt_padding,
            fmt_border: dto.fmt_border,
            fmt_position: dto.fmt_position,
            fmt_is_blockquote: dto.fmt_is_blockquote,
            table: dto.table,
            byte_range: (0, 0),
        }
    }
}

impl From<&CreateFrameDto> for Frame {
    fn from(dto: &CreateFrameDto) -> Self {
        Frame {
            id: 0,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            parent_frame: dto.parent_frame,
            blocks: dto.blocks.clone(),
            child_order: dto.child_order.clone(),
            fmt_height: dto.fmt_height,
            fmt_width: dto.fmt_width,
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_padding: dto.fmt_padding,
            fmt_border: dto.fmt_border,
            fmt_position: dto.fmt_position.clone(),
            fmt_is_blockquote: dto.fmt_is_blockquote,
            table: dto.table,
            byte_range: (0, 0),
        }
    }
}

impl From<Frame> for CreateFrameDto {
    fn from(entity: Frame) -> Self {
        CreateFrameDto {
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            parent_frame: entity.parent_frame,
            blocks: entity.blocks,
            child_order: entity.child_order,
            fmt_height: entity.fmt_height,
            fmt_width: entity.fmt_width,
            fmt_top_margin: entity.fmt_top_margin,
            fmt_bottom_margin: entity.fmt_bottom_margin,
            fmt_left_margin: entity.fmt_left_margin,
            fmt_right_margin: entity.fmt_right_margin,
            fmt_padding: entity.fmt_padding,
            fmt_border: entity.fmt_border,
            fmt_position: entity.fmt_position,
            fmt_is_blockquote: entity.fmt_is_blockquote,
            table: entity.table,
        }
    }
}

#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct UpdateFrameDto {
    pub id: EntityId,
    pub created_at: chrono::DateTime<chrono::Utc>,
    pub updated_at: chrono::DateTime<chrono::Utc>,
    pub child_order: Vec<i64>,
    pub fmt_height: Option<i64>,
    pub fmt_width: Option<i64>,
    pub fmt_top_margin: Option<i64>,
    pub fmt_bottom_margin: Option<i64>,
    pub fmt_left_margin: Option<i64>,
    pub fmt_right_margin: Option<i64>,
    pub fmt_padding: Option<i64>,
    pub fmt_border: Option<i64>,
    pub fmt_position: Option<FramePosition>,
    pub fmt_is_blockquote: Option<bool>,
}

impl From<UpdateFrameDto> for Frame {
    fn from(dto: UpdateFrameDto) -> Self {
        Frame {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            child_order: dto.child_order,
            fmt_height: dto.fmt_height,
            fmt_width: dto.fmt_width,
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_padding: dto.fmt_padding,
            fmt_border: dto.fmt_border,
            fmt_position: dto.fmt_position,
            fmt_is_blockquote: dto.fmt_is_blockquote,
            parent_frame: Default::default(),
            blocks: Default::default(),
            table: Default::default(),
            byte_range: Default::default(),
        }
    }
}

impl From<&UpdateFrameDto> for Frame {
    fn from(dto: &UpdateFrameDto) -> Self {
        Frame {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            child_order: dto.child_order.clone(),
            fmt_height: dto.fmt_height,
            fmt_width: dto.fmt_width,
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_padding: dto.fmt_padding,
            fmt_border: dto.fmt_border,
            fmt_position: dto.fmt_position.clone(),
            fmt_is_blockquote: dto.fmt_is_blockquote,
            parent_frame: Default::default(),
            blocks: Default::default(),
            table: Default::default(),
            byte_range: Default::default(),
        }
    }
}

impl From<Frame> for UpdateFrameDto {
    fn from(entity: Frame) -> Self {
        UpdateFrameDto {
            id: entity.id,
            created_at: entity.created_at,
            updated_at: entity.updated_at,
            child_order: entity.child_order,
            fmt_height: entity.fmt_height,
            fmt_width: entity.fmt_width,
            fmt_top_margin: entity.fmt_top_margin,
            fmt_bottom_margin: entity.fmt_bottom_margin,
            fmt_left_margin: entity.fmt_left_margin,
            fmt_right_margin: entity.fmt_right_margin,
            fmt_padding: entity.fmt_padding,
            fmt_border: entity.fmt_border,
            fmt_position: entity.fmt_position,
            fmt_is_blockquote: entity.fmt_is_blockquote,
        }
    }
}

impl From<FrameDto> for UpdateFrameDto {
    fn from(dto: FrameDto) -> Self {
        UpdateFrameDto {
            id: dto.id,
            created_at: dto.created_at,
            updated_at: dto.updated_at,
            child_order: dto.child_order,
            fmt_height: dto.fmt_height,
            fmt_width: dto.fmt_width,
            fmt_top_margin: dto.fmt_top_margin,
            fmt_bottom_margin: dto.fmt_bottom_margin,
            fmt_left_margin: dto.fmt_left_margin,
            fmt_right_margin: dto.fmt_right_margin,
            fmt_padding: dto.fmt_padding,
            fmt_border: dto.fmt_border,
            fmt_position: dto.fmt_position,
            fmt_is_blockquote: dto.fmt_is_blockquote,
        }
    }
}
pub use common::direct_access::frame::FrameRelationshipField;

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