package request

import (
	"go-humas-be/app/database/entity"
	"go-humas-be/utils/paginator"
)

type DistrictsGeneric interface {
	ToEntity()
}

type DistrictsQueryRequest struct {
	DisName    string                `json:"disName" validate:"required"`
	CityId     int                   `json:"cityId" validate:"required"`
	Pagination *paginator.Pagination `json:"pagination"`
}

type DistrictsCreateRequest struct {
	DisName string `json:"disName" validate:"required"`
	CityId  int    `json:"cityId" validate:"required"`
}

func (req DistrictsCreateRequest) ToEntity() *entity.Districts {
	return &entity.Districts{
		DisName: req.DisName,
		CityId:  req.CityId,
	}
}

type DistrictsUpdateRequest struct {
	ID      uint   `json:"id" validate:"required"`
	DisName string `json:"disName" validate:"required"`
	CityId  int    `json:"cityId" validate:"required"`
}

func (req DistrictsUpdateRequest) ToEntity() *entity.Districts {
	return &entity.Districts{
		ID:      req.ID,
		DisName: req.DisName,
		CityId:  req.CityId,
	}
}
