package mappers

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

// MapProjectToDTO converts a Project domain object to a ProjectDTO.
func MapProjectToDTO(project entities.Project) dto.ProjectDTO {
	return dto.ProjectDTO{
		ID:          project.ID,
		Name:        project.Name,
		Description: project.Description,
		ClientID:    project.ClientID,
		UserID:      project.UserID,
		CreatedAt:   project.CreatedAt.Format(time.RFC3339),
		UpdatedAt:   project.UpdatedAt.Format(time.RFC3339),
	}
}

// MapCreateDTOToProject converts a ProjectCreateDTO to a Project domain object.
func MapCreateDTOToProject(dto dto.ProjectCreateDTO) entities.ProjectCreate {
	return entities.ProjectCreate{
		Name:        dto.Name,
		Description: dto.Description,
		ClientID:    dto.ClientID,
		UserID:      dto.UserID,
	}
}

// MapUpdateDTOToProject converts a ProjectUpdateDTO to a partial Project domain object.
func MapUpdateDTOToProject(dto dto.ProjectUpdateDTO, ID string) entities.ProjectUpdate {
	return entities.ProjectUpdate{
		ID:          ID,
		Name:        dto.Name,
		Description: dto.Description,
		ClientID:    dto.ClientID,
		UserID:      dto.UserID,
	}
}
