package generalconsent

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

type CreateDto struct {
	Encounter_Id *uint   `json:"encounter_id"`
	Value        *string `json:"value"`
}

type ReadListDto struct {
	FilterDto
	Includes   string `json:"includes"`
	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"`
	Value        *string `json:"value"`
	FileUrl      *string `json:"fileUrl"`
}

func (d GeneralConsent) ToResponse() ResponseDto {
	resp := ResponseDto{
		Encounter_Id: d.Encounter_Id,
		Value:        d.Value,
		FileUrl:      d.FileUrl,
	}
	resp.Main = d.Main
	return resp
}

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