package vclaimreference

import (
	ecore "simrs-vx/internal/domain/base-entities/core"
	"time"
)

type CreateDto struct {
	Encounter_Id *uint      `json:"encounter_id"`
	Date         *time.Time `json:"date"`
	SrcCode      *string    `json:"src_code"`
	SrcName      *string    `json:"src_name"`
	Number       *string    `json:"number"`
}

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

type FilterDto struct {
	Encounter_Id *uint `json:"encounter-id"`
}

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

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

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

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

type ResponseDto struct {
	ecore.Main
	Encounter_Id *uint      `json:"encounter_id"`
	Date         *time.Time `json:"date"`
	SrcCode      *string    `json:"src_code"`
	SrcName      *string    `json:"src_name"`
	Number       *string    `json:"number"`
}

func (d VclaimReference) ToResponse() ResponseDto {
	resp := ResponseDto{
		Encounter_Id: d.Encounter_Id,
		Date:         d.Date,
		SrcCode:      d.SrcCode,
		SrcName:      d.SrcName,
		Number:       d.Number,
	}
	resp.Main = d.Main
	return resp
}

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