package fees

import (
	oracleclient "github.com/tech/sendico/fx/oracle/client"
	clockpkg "github.com/tech/sendico/pkg/clock"
)

// Option configures a Service instance.
type Option func(*Service)

// WithClock sets a custom clock implementation.
func WithClock(clock clockpkg.Clock) Option {
	return func(s *Service) {
		if clock != nil {
			s.clock = clock
		}
	}
}

// WithCalculator sets a custom calculator implementation.
func WithCalculator(calculator Calculator) Option {
	return func(s *Service) {
		if calculator != nil {
			s.calculator = calculator
		}
	}
}

// WithOracleClient wires an FX oracle client for FX trigger evaluations.
func WithOracleClient(oracle oracleclient.Client) Option {
	return func(s *Service) {
		s.oracle = oracle
		if qc, ok := s.calculator.(*quoteCalculator); ok {
			qc.oracle = oracle
		}
	}
}
