package realname

import "context"

type UnavailableProvider struct {
	err error
}

func NewUnavailableProvider(err error) *UnavailableProvider {
	return &UnavailableProvider{err: err}
}

func (p *UnavailableProvider) Name() string {
	return "unavailable"
}

func (p *UnavailableProvider) Start(ctx context.Context, req StartRequest) (ProviderResult, error) {
	if err := ctx.Err(); err != nil {
		return ProviderResult{}, err
	}
	if p.err != nil {
		return ProviderResult{}, p.err
	}
	return ProviderResult{}, ErrProviderConfigInvalid
}
