package request

import (
	"narasi-ahli-be/app/database/entity"
	"narasi-ahli-be/utils/paginator"
)

type CitiesGeneric interface {
	ToEntity()
}

type CitiesQueryRequest struct {
	CityName   string                `json:"cityName" validate:"required"`
	ProvId     int                   `json:"provId" validate:"required"`
	Pagination *paginator.Pagination `json:"pagination"`
}

type CitiesCreateRequest struct {
	CityName string `json:"cityName" validate:"required"`
	ProvId   int    `json:"provId" validate:"required"`
}

func (req CitiesCreateRequest) ToEntity() *entity.Cities {
	return &entity.Cities{
		CityName: req.CityName,
		ProvId:   req.ProvId,
	}
}

type CitiesUpdateRequest struct {
	ID       uint   `json:"id" validate:"required"`
	CityName string `json:"cityName" validate:"required"`
	ProvId   int    `json:"provId" validate:"required"`
}

func (req CitiesUpdateRequest) ToEntity() *entity.Cities {
	return &entity.Cities{
		ID:       req.ID,
		CityName: req.CityName,
		ProvId:   req.ProvId,
	}
}
