package procedureroomorder

import (
	ecore "simrs-vx/internal/domain/base-entities/core"
	epr "simrs-vx/internal/domain/main-entities/procedure-room"
)

type CreateDto struct {
	ProcedureRoomOrder_Id uint64 `json:"procedureRoomOrder_id"`
	ProcedureRoom_Code    string `json:"procedureRoom_code"`
	Note                  string `json:"note"`
}

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

type FilterDto struct {
	Encounter_Id          uint64 `json:"encounter-id"`
	ProcedureRoomOrder_Id uint64 `json:"procedure-room-order-id"`
}

type ReadDetailDto struct {
	Id       uint64 `json:"id"`
	Includes string `json:"includes"`
}

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

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

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

type ResponseDto struct {
	ecore.BigMain
	ProcedureRoomOrder_Id uint64             `json:"procedureRoomOrder_id"`
	ProcedureRoom_Code    string             `json:"procedureRoom_code"`
	ProcedureRoom         *epr.ProcedureRoom `json:"procedureRoom,omitempty"`
	Note                  string             `json:"note"`
}

func (d ProcedureRoomOrderItem) ToResponse() ResponseDto {
	resp := ResponseDto{
		ProcedureRoomOrder_Id: d.ProcedureRoomOrder_Id,
		ProcedureRoom_Code:    d.ProcedureRoom_Code,
		ProcedureRoom:         d.ProcedureRoom,
		Note:                  d.Note,
	}
	resp.Id = d.Id
	return resp
}

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