package services

import (
	"context"

	"github.com/rede5/gohorsejobs/backend/internal/core/domain/entity"
	"github.com/rede5/gohorsejobs/backend/internal/infrastructure/persistence/postgres"
)

type LocationService struct {
	repo *postgres.LocationRepository
}

func NewLocationService(repo *postgres.LocationRepository) *LocationService {
	return &LocationService{repo: repo}
}

func (s *LocationService) ListCountries(ctx context.Context) ([]*entity.Country, error) {
	return s.repo.ListCountries(ctx)
}

func (s *LocationService) ListStates(ctx context.Context, countryID int64) ([]*entity.State, error) {
	return s.repo.ListStates(ctx, countryID)
}

func (s *LocationService) ListCities(ctx context.Context, stateID int64) ([]*entity.City, error) {
	return s.repo.ListCities(ctx, stateID)
}

func (s *LocationService) Search(ctx context.Context, query string, countryID int64) ([]*entity.LocationSearchResult, error) {
	return s.repo.Search(ctx, query, countryID)
}
