package mappers

import (
	"apskel-pos-be/internal/entities"
	"apskel-pos-be/internal/models"
)

func OutletEntityToResponse(entity *entities.Outlet) *models.OutletResponse {
	if entity == nil {
		return nil
	}

	return &models.OutletResponse{
		ID:             entity.ID,
		OrganizationID: entity.OrganizationID,
		Name:           entity.Name,
		Address:        entity.Address,
		Timezone:       entity.Timezone,
		Currency:       entity.Currency,
		TaxRate:        entity.TaxRate,
		IsActive:       entity.IsActive,
		CreatedAt:      entity.CreatedAt,
		UpdatedAt:      entity.UpdatedAt,
	}
}

func OutletEntitiesToResponses(entities []*entities.Outlet) []*models.OutletResponse {
	if entities == nil {
		return nil
	}

	responses := make([]*models.OutletResponse, len(entities))
	for i, entity := range entities {
		responses[i] = OutletEntityToResponse(entity)
	}
	return responses
}
