package ticket

import (
	"context"

	"github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
)

type Service struct {
	ticketStore TicketStore
}

func NewService(ticketStore TicketStore) *Service {
	return &Service{
		ticketStore: ticketStore,
	}
}

func (s *Service) CreateTicket(ctx context.Context, ticket domain.CreateTicket) (domain.Ticket, error) {
	return s.ticketStore.CreateTicket(ctx, ticket)
}

func (s *Service) CreateTicketOutcome(ctx context.Context, outcomes []domain.CreateTicketOutcome) (int64, error) {
	return s.ticketStore.CreateTicketOutcome(ctx, outcomes)
}

func (s *Service) GetTicketByID(ctx context.Context, id int64) (domain.GetTicket, error) {
	return s.ticketStore.GetTicketByID(ctx, id)
}
func (s *Service) GetAllTickets(ctx context.Context) ([]domain.GetTicket, error) {
	return s.ticketStore.GetAllTickets(ctx)
}

func (s *Service) CountTicketByIP(ctx context.Context, IP string) (int64, error) {
	return s.ticketStore.CountTicketByIP(ctx, IP)
}

func (s *Service) UpdateTicketOutcomeStatus(ctx context.Context, id int64, status domain.OutcomeStatus) error {
	return s.ticketStore.UpdateTicketOutcomeStatus(ctx, id, status)
}
func (s *Service) DeleteTicket(ctx context.Context, id int64) error {
	return s.ticketStore.DeleteTicket(ctx, id)
}

func (s *Service) DeleteOldTickets(ctx context.Context) error {
	return s.ticketStore.DeleteOldTickets(ctx)
}
