package service

import (
	"apskel-pos-be/internal/models"
	"context"

	"github.com/google/uuid"
)

type UnitServiceImpl struct {
	unitProcessor UnitProcessor
}

func NewUnitService(unitProcessor UnitProcessor) *UnitServiceImpl {
	return &UnitServiceImpl{
		unitProcessor: unitProcessor,
	}
}

func (s *UnitServiceImpl) CreateUnit(ctx context.Context, req *models.CreateUnitRequest) (*models.UnitResponse, error) {
	return s.unitProcessor.CreateUnit(ctx, req)
}

func (s *UnitServiceImpl) UpdateUnit(ctx context.Context, id uuid.UUID, req *models.UpdateUnitRequest) (*models.UnitResponse, error) {
	return s.unitProcessor.UpdateUnit(ctx, id, req)
}

func (s *UnitServiceImpl) DeleteUnit(ctx context.Context, id uuid.UUID) error {
	return s.unitProcessor.DeleteUnit(ctx, id)
}

func (s *UnitServiceImpl) GetUnitByID(ctx context.Context, id uuid.UUID) (*models.UnitResponse, error) {
	return s.unitProcessor.GetUnitByID(ctx, id)
}

func (s *UnitServiceImpl) ListUnits(ctx context.Context, organizationID uuid.UUID, outletID *uuid.UUID, page, limit int, search string) (*models.PaginatedResponse[models.UnitResponse], error) {
	return s.unitProcessor.ListUnits(ctx, organizationID, outletID, page, limit, search)
}
