// Code generated by Fern. DO NOT EDIT.

package option

import (
	context "context"
	http "net/http"
	url "net/url"

	core "github.com/auth0/go-auth0/v2/management/core"
)

// RequestOption adapts the behavior of an individual request.
type RequestOption = core.RequestOption

// WithBaseURL sets the base URL, overriding the default
// environment, if any.
func WithBaseURL(baseURL string) *core.BaseURLOption {
	return &core.BaseURLOption{
		BaseURL: baseURL,
	}
}

// WithHTTPClient uses the given HTTPClient to issue the request.
func WithHTTPClient(httpClient core.HTTPClient) *core.HTTPClientOption {
	return &core.HTTPClientOption{
		HTTPClient: httpClient,
	}
}

// WithHTTPHeader adds the given http.Header to the request.
func WithHTTPHeader(httpHeader http.Header) *core.HTTPHeaderOption {
	return &core.HTTPHeaderOption{
		// Clone the headers so they can't be modified after the option call.
		HTTPHeader: httpHeader.Clone(),
	}
}

// WithBodyProperties adds the given body properties to the request.
func WithBodyProperties(bodyProperties map[string]interface{}) *core.BodyPropertiesOption {
	copiedBodyProperties := make(map[string]interface{}, len(bodyProperties))
	for key, value := range bodyProperties {
		copiedBodyProperties[key] = value
	}
	return &core.BodyPropertiesOption{
		BodyProperties: copiedBodyProperties,
	}
}

// WithQueryParameters adds the given query parameters to the request.
func WithQueryParameters(queryParameters url.Values) *core.QueryParametersOption {
	copiedQueryParameters := make(url.Values, len(queryParameters))
	for key, values := range queryParameters {
		copiedQueryParameters[key] = values
	}
	return &core.QueryParametersOption{
		QueryParameters: copiedQueryParameters,
	}
}

// WithMaxAttempts configures the maximum number of retry attempts.
func WithMaxAttempts(attempts uint) *core.MaxAttemptsOption {
	return &core.MaxAttemptsOption{
		MaxAttempts: attempts,
	}
}

// WithToken sets the 'Authorization: Bearer <token>' request header.
func WithToken(token string) *core.TokenOption {
	return &core.TokenOption{
		Token: token,
	}
}

func WithClientCredentials(ctx context.Context, clientID, clientSecret string) *core.ClientCredentialsOption {
	// ctx is currently unused, but included for future extensibility.
	return &core.ClientCredentialsOption{
		Ctx:          &ctx,
		ClientID:     clientID,
		ClientSecret: clientSecret,
	}
}

func WithClientCredentialsAndAudience(ctx context.Context, clientID, clientSecret, audience string) *core.ClientCredentialsAndAudienceOption {
	return &core.ClientCredentialsAndAudienceOption{
		Ctx:          &ctx,
		ClientID:     clientID,
		ClientSecret: clientSecret,
		Audience:     audience,
	}
}

func WithClientCredentialsPrivateKeyJwtAndAudience(ctx context.Context, clientID string, privateKey string, algorithm, audience string) *core.ClientCredentialsPrivateKeyJwtAndAudienceOption {
	return &core.ClientCredentialsPrivateKeyJwtAndAudienceOption{
		Ctx:        &ctx,
		ClientID:   clientID,
		PrivateKey: privateKey,
		Algorithm:  algorithm,
		Audience:   audience,
	}
}

// WithClientCredentialsPrivateKeyJwt sets client credentials using private key JWT.
func WithClientCredentialsPrivateKeyJwt(ctx context.Context, clientID string, privateKey string, algorithm string) *core.ClientCredentialsPrivateKeyJwtOption {
	return &core.ClientCredentialsPrivateKeyJwtOption{
		Ctx:        &ctx,
		ClientID:   clientID,
		PrivateKey: privateKey,
		Algorithm:  algorithm,
	}
}

// WithDebug configures the HTTP client to enable debug logging of requests and responses.
func WithDebug(debug bool) *core.DebugOption {
	return &core.DebugOption{
		Debug: debug,
	}
}

// WithUserAgent configures the HTTP client to use a custom User-Agent header.
func WithUserAgent(userAgent string) *core.UserAgentOption {
	return &core.UserAgentOption{
		UserAgent: userAgent,
	}
}

// WithInsecure configures the client to allow HTTP instead of HTTPS and sets
// a static "insecure" token for testing.
//
// This option is available for testing purposes and should not be used in production.
// Note: Users should pass the domain without a scheme (e.g., "localhost:8080").
func WithInsecure() *core.InsecureOption {
	return &core.InsecureOption{}
}

// WithAuth0ClientEnvEntry allows adding extra environment keys to the client information.
func WithAuth0ClientEnvEntry(key string, value string) *core.Auth0ClientEnvEntryOption {
	return &core.Auth0ClientEnvEntryOption{
		Key:   key,
		Value: value,
	}
}

// WithNoAuth0ClientInfo configures the client to not send the "Auth0-Client" header at all.
func WithNoAuth0ClientInfo() *core.NoAuth0ClientInfoOption {
	return &core.NoAuth0ClientInfoOption{}
}

// WithCustomDomainHeader sets the custom domain for the Management instance.
// The custom domain header is only sent for whitelisted API endpoints.
func WithCustomDomainHeader(domain string) *core.CustomDomainHeaderOption {
	return &core.CustomDomainHeaderOption{
		CustomDomainHeader: domain,
	}
}
