package mappers

import (
	"actatempus_backend/internal/application/services/dto"
	"actatempus_backend/internal/domain/entities"
	"time"
)

// MapUserToDTO converts a User domain object to a UserDTO.
func MapUserToDTO(user entities.User) dto.UserDTO {
	return dto.UserDTO{
		ID:        user.ID,
		Name:      user.Name,
		Email:     user.Email,
		CreatedAt: user.CreatedAt.Format(time.RFC3339),
		UpdatedAt: user.UpdatedAt.Format(time.RFC3339),
	}
}

// MapCreateDTOToUser converts a UserCreateDTO to a User domain object.
func MapCreateDTOToUser(dto dto.UserCreateDTO) entities.UserCreate {
	return entities.UserCreate{
		Name:     dto.Name,
		Email:    dto.Email,
		Password: dto.Password,
	}
}

// MapUpdateDTOToUser converts a UserUpdateDTO to a partial User domain object.
func MapUpdateDTOToUser(dto dto.UserUpdateDTO, ID string) entities.UserUpdate {
	return entities.UserUpdate{
		ID:       ID,
		Name:     dto.Name,
		Email:    dto.Email,
		Password: dto.Password,
	}
}
