/*
DESCRIPTION:
Any functions that are used internally by the use-case
*/
package employee

import (
	e "simrs-vx/internal/domain/main-entities/employee"
)

func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Employee) {
	var inputSrc *e.CreateDto
	if inputT, ok := any(input).(*e.CreateDto); ok {
		inputSrc = inputT
	} else {
		inputTemp := any(input).(*e.UpdateDto)
		inputSrc = &inputTemp.CreateDto
	}

	data.User_Id = inputSrc.User_Id
	data.Person_Id = inputSrc.Person_Id
	data.Number = inputSrc.Number
	data.Status_Code = inputSrc.Status_Code
	data.Position_Code = inputSrc.Position_Code
}

// func createUser(input *e.CreateDto, event *pl.Event, tx *gorm.DB) error {
// 	if input.User == nil {
// 		event.Status = "failed"
// 		event.ErrInfo = pl.ErrorInfo{
// 			Code:   "data-create-fail",
// 			Detail: "user request is required",
// 			Raw:    errors.New("user request is required"),
// 		}
// 		return pl.SetLogError(event, input)
// 	}
// 	user, err := uu.CreateData(*input.User, event, tx)
// 	if err != nil {
// 		return err
// 	}
// 	input.User_Id = &user.Id
// 	return nil
// }
