package branch

import (
	"context"

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

type Service struct {
	branchStore BranchStore
}

func NewService(branchStore BranchStore) *Service {
	return &Service{
		branchStore: branchStore,
	}
}

func (s *Service) CreateBranch(ctx context.Context, branch domain.CreateBranch) (domain.Branch, error) {
	return s.branchStore.CreateBranch(ctx, branch)
}
func (s *Service) CreateSupportedOperation(ctx context.Context, supportedOperation domain.CreateSupportedOperation) (domain.SupportedOperation, error) {
	return s.branchStore.CreateSupportedOperation(ctx, supportedOperation)
}
func (s *Service) CreateBranchOperation(ctx context.Context, branchOperation domain.CreateBranchOperation) error {
	return s.branchStore.CreateBranchOperation(ctx, branchOperation)
}

func (s *Service) CreateBranchCashier(ctx context.Context, branchID int64, userID int64) error {
	return s.branchStore.CreateBranchCashier(ctx, branchID, userID)
}

func (s *Service) GetBranchByID(ctx context.Context, id int64) (domain.BranchDetail, error) {
	return s.branchStore.GetBranchByID(ctx, id)
}
func (s *Service) GetBranchByManagerID(ctx context.Context, branchManagerID int64) ([]domain.BranchDetail, error) {
	return s.branchStore.GetBranchByManagerID(ctx, branchManagerID)
}
func (s *Service) GetBranchByCompanyID(ctx context.Context, companyID int64) ([]domain.BranchDetail, error) {
	return s.branchStore.GetBranchByCompanyID(ctx, companyID)
}
func (s *Service) GetBranchOperations(ctx context.Context, branchID int64) ([]domain.BranchOperation, error) {
	return s.branchStore.GetBranchOperations(ctx, branchID)
}
func (s *Service) GetAllBranches(ctx context.Context) ([]domain.BranchDetail, error) {
	return s.branchStore.GetAllBranches(ctx)
}

func (s *Service) GetBranchByCashier(ctx context.Context, userID int64) (domain.Branch, error) {
	return s.branchStore.GetBranchByCashier(ctx, userID)
}

func (s *Service) GetAllSupportedOperations(ctx context.Context) ([]domain.SupportedOperation, error) {
	return s.branchStore.GetAllSupportedOperations(ctx)
}

func (s *Service) SearchBranchByName(ctx context.Context, name string) ([]domain.BranchDetail, error) {
	return s.branchStore.SearchBranchByName(ctx, name)
}
func (s *Service) UpdateBranch(ctx context.Context, branch domain.UpdateBranch) (domain.Branch, error) {
	return s.branchStore.UpdateBranch(ctx, branch)
}
func (s *Service) DeleteBranch(ctx context.Context, id int64) error {
	return s.branchStore.DeleteBranch(ctx, id)
}
func (s *Service) DeleteBranchOperation(ctx context.Context, branchID int64, operationID int64) error {
	return s.branchStore.DeleteBranchOperation(ctx, branchID, operationID)
}

func (s *Service) DeleteBranchCashier(ctx context.Context, userID int64) error {
	return s.branchStore.DeleteBranchCashier(ctx, userID)
}

func (s *Service) GetAllCompaniesBranch(ctx context.Context) ([]domain.Company, error) {
	return s.branchStore.GetAllCompaniesBranch(ctx)
}

func (s *Service) GetBranchesByCompany(ctx context.Context, companyID int64) ([]domain.Branch, error) {
	return s.branchStore.GetBranchesByCompany(ctx, companyID)
}
