package vclaimsepcontrolletter

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

type CreateDto struct {
	VclaimSep_Number *string `json:"vclaimSep_number"`
	Number           *string `json:"number" gorm:"unique;size:20"`
	Value            *string `json:"value"`
	FileUrl          *string `json:"fileUrl" gorm:"unique;size:1024"`
}

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

type FilterDto struct {
	VclaimSep_Number *string `json:"vclaimSep_number"`
}

type ReadDetailDto struct {
	Id     *uint   `json:"id"`
	Number *string `json:"number"`
}

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

type DeleteDto struct {
	Id     uint    `json:"id"`
	Number *string `json:"number"`
}

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

type ResponseDto struct {
	ecore.Main
	VclaimSep_Number *string `json:"vclaimSep_number"`
	Number           *string `json:"number"`
	Value            *string `json:"value"`
	FileUrl          *string `json:"fileUrl"`
}

func (d VclaimSepControlLetter) ToResponse() ResponseDto {
	resp := ResponseDto{
		VclaimSep_Number: d.VclaimSep_Number,
		Number:           d.Number,
		Value:            d.Value,
		FileUrl:          d.FileUrl,
	}
	resp.Main = d.Main
	return resp
}

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