package vclaimmember

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

type CreateDto struct {
	CardNumber *string `json:"cardNumber" validate:"maxLength=20"`
	Person_Id  *uint   `json:"person_id"`
}

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

type FilterDto struct {
	CardNumber *string `json:"cardNumber"`
}

type ReadDetailDto struct {
	Id         uint    `json:"id"`
	CardNumber *string `json:"cardNumber"`
}

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

type DeleteDto struct {
	Id         uint    `json:"id"`
	CardNumber *string `json:"cardNumber"`
}

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

type ResponseDto struct {
	ecore.Main
	CardNumber *string `json:"cardNumber"`
}

func (d VclaimMember) ToResponse() ResponseDto {
	resp := ResponseDto{
		CardNumber: d.CardNumber,
	}
	resp.Main = d.Main
	return resp
}

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