package transformer

import (
	"apskel-pos-be/internal/constants"
	"apskel-pos-be/internal/contract"
	"apskel-pos-be/internal/models"
)

func CreateOutletRequestToModel(req *contract.CreateOutletRequest) *models.CreateOutletRequest {
	return &models.CreateOutletRequest{
		OrganizationID: req.OrganizationID,
		Name:           req.Name,
		Address:        req.Address,
		PhoneNumber:    req.PhoneNumber,
		BusinessType:   constants.BusinessTypeRestaurant,
		Currency:       constants.Currency(req.Currency),
		TaxRate:        req.TaxRate,
	}
}

func UpdateOutletRequestToModel(req *contract.UpdateOutletRequest) *models.UpdateOutletRequest {
	return &models.UpdateOutletRequest{
		Name:           req.Name,
		Address:        req.Address,
		PhoneNumber:    req.PhoneNumber,
		TaxRate:        req.TaxRate,
		IsActive:       req.IsActive,
		OrganizationID: req.OrganizationID,
	}
}

func OutletModelResponseToResponse(model *models.OutletResponse) contract.OutletResponse {
	return contract.OutletResponse{
		ID:             model.ID,
		OrganizationID: model.OrganizationID,
		Name:           model.Name,
		Address:        *model.Address,
		BusinessType:   string(constants.BusinessTypeRestaurant),
		Currency:       model.Currency,
		TaxRate:        model.TaxRate,
		IsActive:       model.IsActive,
		CreatedAt:      model.CreatedAt,
		UpdatedAt:      model.UpdatedAt,
	}
}
