package radiologymcuorderitem

import (
	ecore "simrs-vx/internal/domain/base-entities/core"
	ems "simrs-vx/internal/domain/main-entities/mcu-src"
	emro "simrs-vx/internal/domain/main-entities/radiology-mcu-order"
	erc "simrs-vx/internal/domain/references/common"
	"time"
)

type CreateDto struct {
	RadiologyMcuOrder_Id uint64 `json:"radiologyMcuOrder_id"`
	McuSrc_Code          string `json:"mcuSrc_code"`
}

type ReadListDto struct {
	FilterDto
	Includes   string `json:"includes"`
	Pagination ecore.Pagination
}

type FilterDto struct {
	RadiologyMcuOrder_Id *uint64            `json:"radiology-mcu-order-id"`
	McuSrc_Code          *string            `json:"mcu-src-code"`
	Status_Code          erc.DataStatusCode `json:"status-code"`
}
type ReadDetailDto struct {
	Id uint `json:"id"`
}

type UpdateDto struct {
	Id uint `json:"id"`
	CreateDto
}

type DeleteDto struct {
	Id uint `json:"id"`
}

type SetScheduleDto struct {
	Id              uint       `json:"id"`
	ExaminationDate *time.Time `json:"examinationDate"`
}

type MetaDto struct {
	PageNumber int `json:"page_number"`
	PageSize   int `json:"page_size"`
	Count      int `json:"count"`
}

type ResponseDto struct {
	ecore.BigMain
	RadiologyMcuOrder_Id uint64                  `json:"radiologyMcuOrder_id"`
	RadiologyMcuOrder    *emro.RadiologyMcuOrder `json:"radiologyMcuOrder,omitempty"`
	McuSrc_Code          string                  `json:"mcuSrc_code"`
	McuSrc               *ems.McuSrc             `json:"mcuSrc,omitempty"`
	Result               *string                 `json:"result"`
	Status_Code          erc.DataStatusCode      `json:"status_code"`
}

func (d RadiologyMcuOrderItem) ToResponse() ResponseDto {
	resp := ResponseDto{
		RadiologyMcuOrder_Id: d.RadiologyMcuOrder_Id,
		RadiologyMcuOrder:    d.RadiologyMcuOrder,
		McuSrc_Code:          d.McuSrc_Code,
		McuSrc:               d.McuSrc,
		Result:               d.Result,
		Status_Code:          d.Status_Code,
	}
	resp.BigMain = d.BigMain
	return resp
}

func ToResponseList(data []RadiologyMcuOrderItem) []ResponseDto {
	resp := make([]ResponseDto, len(data))
	for i, u := range data {
		resp[i] = u.ToResponse()
	}
	return resp
}
