package authinfra

import "context"

type AuthInfrastructureService interface {
	CreatePasswordResetOTP(ctx context.Context, request *PasswordResetOTPCreateRequest) (*PasswordResetOTPCreateResponse, error)
	ValidatePasswordResetOTP(ctx context.Context, request *ValidatePasswordResetOTPRequest) (*ValidatePasswordResetOTPResponse, error)
	ValidatePasswordResetToken(ctx context.Context, request *ValidatePasswordResetTokenRequest) (*ValidatePasswordResetTokenResponse, error)
}

func New(typ Type, cfg Config) (AuthInfrastructureService, error) {
	switch typ {
	case CacheAuthInfrastructureServiceType:
		config, ok := cfg.(CacheAuthInfraServiceConfig)
		if !ok {
			return nil, ErrInvalidConfig
		}

		return newCacheAuthInfraService(config), nil

	default:
		return nil, ErrUnknownAuthInfrastructureServiceType
	}
}
