// Code generated by applyconfiguration-gen. DO NOT EDIT.

package v1

import (
	configv1 "github.com/openshift/api/config/v1"
)

// PolicyRootOfTrustApplyConfiguration represents a declarative configuration of the PolicyRootOfTrust type for use
// with apply.
//
// PolicyRootOfTrust defines the root of trust based on the selected policyType.
type PolicyRootOfTrustApplyConfiguration struct {
	// policyType is a required field specifies the type of the policy for verification. This field must correspond to how the policy was generated.
	// Allowed values are "PublicKey", "FulcioCAWithRekor", and "PKI".
	// When set to "PublicKey", the policy relies on a sigstore publicKey and may optionally use a Rekor verification.
	// When set to "FulcioCAWithRekor", the policy is based on the Fulcio certification and incorporates a Rekor verification.
	// When set to "PKI", the policy is based on the certificates from Bring Your Own Public Key Infrastructure (BYOPKI).
	PolicyType *configv1.PolicyType `json:"policyType,omitempty"`
	// publicKey defines the root of trust configuration based on a sigstore public key. Optionally include a Rekor public key for Rekor verification.
	// publicKey is required when policyType is PublicKey, and forbidden otherwise.
	PublicKey *ImagePolicyPublicKeyRootOfTrustApplyConfiguration `json:"publicKey,omitempty"`
	// fulcioCAWithRekor defines the root of trust configuration based on the Fulcio certificate and the Rekor public key.
	// fulcioCAWithRekor is required when policyType is FulcioCAWithRekor, and forbidden otherwise
	// For more information about Fulcio and Rekor, please refer to the document at:
	// https://github.com/sigstore/fulcio and https://github.com/sigstore/rekor
	FulcioCAWithRekor *ImagePolicyFulcioCAWithRekorRootOfTrustApplyConfiguration `json:"fulcioCAWithRekor,omitempty"`
	// pki defines the root of trust configuration based on Bring Your Own Public Key Infrastructure (BYOPKI) Root CA(s) and corresponding intermediate certificates.
	// pki is required when policyType is PKI, and forbidden otherwise.
	PKI *ImagePolicyPKIRootOfTrustApplyConfiguration `json:"pki,omitempty"`
}

// PolicyRootOfTrustApplyConfiguration constructs a declarative configuration of the PolicyRootOfTrust type for use with
// apply.
func PolicyRootOfTrust() *PolicyRootOfTrustApplyConfiguration {
	return &PolicyRootOfTrustApplyConfiguration{}
}

// WithPolicyType sets the PolicyType field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PolicyType field is set to the value of the last call.
func (b *PolicyRootOfTrustApplyConfiguration) WithPolicyType(value configv1.PolicyType) *PolicyRootOfTrustApplyConfiguration {
	b.PolicyType = &value
	return b
}

// WithPublicKey sets the PublicKey field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PublicKey field is set to the value of the last call.
func (b *PolicyRootOfTrustApplyConfiguration) WithPublicKey(value *ImagePolicyPublicKeyRootOfTrustApplyConfiguration) *PolicyRootOfTrustApplyConfiguration {
	b.PublicKey = value
	return b
}

// WithFulcioCAWithRekor sets the FulcioCAWithRekor field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the FulcioCAWithRekor field is set to the value of the last call.
func (b *PolicyRootOfTrustApplyConfiguration) WithFulcioCAWithRekor(value *ImagePolicyFulcioCAWithRekorRootOfTrustApplyConfiguration) *PolicyRootOfTrustApplyConfiguration {
	b.FulcioCAWithRekor = value
	return b
}

// WithPKI sets the PKI field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the PKI field is set to the value of the last call.
func (b *PolicyRootOfTrustApplyConfiguration) WithPKI(value *ImagePolicyPKIRootOfTrustApplyConfiguration) *PolicyRootOfTrustApplyConfiguration {
	b.PKI = value
	return b
}
