package request

import (
	"time"
	"web-qudo-be/app/database/entity"
	"web-qudo-be/utils/paginator"
)

type UserRoleLevelDetailsGeneric interface {
	ToEntity()
}

type UserRoleLevelDetailsQueryRequest struct {
	UserRoleId  uint                  `json:"user_role_id" validate:"required"`
	UserLevelId uint                  `json:"user_level_id" validate:"required"`
	Pagination  *paginator.Pagination `json:"pagination"`
}

type UserRoleLevelDetailsCreateRequest struct {
	UserRoleId  uint  `json:"user_role_id" validate:"required"`
	UserLevelId uint  `json:"user_level_id" validate:"required"`
	IsActive    *bool `json:"is_active" validate:"required"`
}

func (req UserRoleLevelDetailsCreateRequest) ToEntity() *entity.UserRoleLevelDetails {
	return &entity.UserRoleLevelDetails{
		UserRoleId:  req.UserRoleId,
		UserLevelId: req.UserLevelId,
		IsActive:    req.IsActive,
	}
}

type UserRoleLevelDetailsUpdateRequest struct {
	ID          uint      `json:"id" validate:"required"`
	UserRoleId  uint      `json:"user_role_id" validate:"required"`
	UserLevelId uint      `json:"user_level_id" validate:"required"`
	IsActive    *bool     `json:"is_active" validate:"required"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

func (req UserRoleLevelDetailsUpdateRequest) ToEntity() *entity.UserRoleLevelDetails {
	return &entity.UserRoleLevelDetails{
		ID:          req.ID,
		UserRoleId:  req.UserRoleId,
		UserLevelId: req.UserLevelId,
		IsActive:    req.IsActive,
		CreatedAt:   req.CreatedAt,
		UpdatedAt:   req.UpdatedAt,
	}
}
