//! Auto-generated models for helm-controller
//! Generated from: helm-controller.crds.yaml
//! DO NOT EDIT - This file is auto-generated by kopium
#![allow(clippy::all)]

// WARNING: generated by kopium - manual changes will be overwritten
// kopium command: kopium --filename /tmp/tmp.zMlAR0q4EF/doc1.yaml --derive Default --derive PartialEq --docs --smart-derive-elision
// kopium version: 0.23.0

#[allow(unused_imports)]
mod prelude {
    pub use k8s_openapi::apimachinery::pkg::apis::meta::v1::Condition;
    pub use kube::CustomResource;
    pub use serde::{Deserialize, Serialize};
    pub use std::collections::BTreeMap;
}

use self::prelude::*;

/// HelmReleaseSpec defines the desired state of a Helm release.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[kube(
    group = "helm.toolkit.fluxcd.io",
    version = "v2",
    kind = "HelmRelease",
    plural = "helmreleases"
)]
#[kube(namespaced)]
#[kube(status = "HelmReleaseStatus")]
#[kube(schema = "disabled")]
#[kube(derive = "Default")]
#[kube(derive = "PartialEq")]
pub struct HelmReleaseSpec {
    /// Chart defines the template of the v1.HelmChart that should be created
    /// for this HelmRelease.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub chart: Option<HelmReleaseChart>,
    /// ChartRef holds a reference to a source controller resource containing the
    /// Helm chart artifact.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "chartRef")]
    pub chart_ref: Option<HelmReleaseChartRef>,
    /// CommonMetadata specifies the common labels and annotations that are
    /// applied to all resources. Any existing label or annotation will be
    /// overridden if its key matches a common one.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "commonMetadata"
    )]
    pub common_metadata: Option<HelmReleaseCommonMetadata>,
    /// DependsOn may contain a DependencyReference slice with
    /// references to HelmRelease resources that must be ready before this HelmRelease
    /// can be reconciled.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "dependsOn")]
    pub depends_on: Option<Vec<HelmReleaseDependsOn>>,
    /// DriftDetection holds the configuration for detecting and handling
    /// differences between the manifest in the Helm storage and the resources
    /// currently existing in the cluster.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "driftDetection"
    )]
    pub drift_detection: Option<HelmReleaseDriftDetection>,
    /// HealthCheckExprs is a list of healthcheck expressions for evaluating the
    /// health of custom resources using Common Expression Language (CEL).
    /// The expressions are evaluated only when the specific Helm action
    /// taking place has wait enabled, i.e. DisableWait is false, and the
    /// 'poller' WaitStrategy is used.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "healthCheckExprs"
    )]
    pub health_check_exprs: Option<Vec<HelmReleaseHealthCheckExprs>>,
    /// Install holds the configuration for Helm install actions for this HelmRelease.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub install: Option<HelmReleaseInstall>,
    /// Interval at which to reconcile the Helm release.
    pub interval: String,
    /// KubeConfig for reconciling the HelmRelease on a remote cluster.
    /// When used in combination with HelmReleaseSpec.ServiceAccountName,
    /// forces the controller to act on behalf of that Service Account at the
    /// target cluster.
    /// If the --default-service-account flag is set, its value will be used as
    /// a controller level fallback for when HelmReleaseSpec.ServiceAccountName
    /// is empty.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "kubeConfig"
    )]
    pub kube_config: Option<HelmReleaseKubeConfig>,
    /// MaxHistory is the number of revisions saved by Helm for this HelmRelease.
    /// Use '0' for an unlimited number of revisions; defaults to '5'.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "maxHistory"
    )]
    pub max_history: Option<i64>,
    /// PersistentClient tells the controller to use a persistent Kubernetes
    /// client for this release. When enabled, the client will be reused for the
    /// duration of the reconciliation, instead of being created and destroyed
    /// for each (step of a) Helm action.
    ///
    /// This can improve performance, but may cause issues with some Helm charts
    /// that for example do create Custom Resource Definitions during installation
    /// outside Helm's CRD lifecycle hooks, which are then not observed to be
    /// available by e.g. post-install hooks.
    ///
    /// If not set, it defaults to true.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "persistentClient"
    )]
    pub persistent_client: Option<bool>,
    /// PostRenderers holds an array of Helm PostRenderers, which will be applied in order
    /// of their definition.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "postRenderers"
    )]
    pub post_renderers: Option<Vec<HelmReleasePostRenderers>>,
    /// ReleaseName used for the Helm release. Defaults to a composition of
    /// '[TargetNamespace-]Name'.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "releaseName"
    )]
    pub release_name: Option<String>,
    /// Rollback holds the configuration for Helm rollback actions for this HelmRelease.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub rollback: Option<HelmReleaseRollback>,
    /// The name of the Kubernetes service account to impersonate
    /// when reconciling this HelmRelease.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "serviceAccountName"
    )]
    pub service_account_name: Option<String>,
    /// StorageNamespace used for the Helm storage.
    /// Defaults to the namespace of the HelmRelease.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "storageNamespace"
    )]
    pub storage_namespace: Option<String>,
    /// Suspend tells the controller to suspend reconciliation for this HelmRelease,
    /// it does not apply to already started reconciliations. Defaults to false.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub suspend: Option<bool>,
    /// TargetNamespace to target when performing operations for the HelmRelease.
    /// Defaults to the namespace of the HelmRelease.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "targetNamespace"
    )]
    pub target_namespace: Option<String>,
    /// Test holds the configuration for Helm test actions for this HelmRelease.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub test: Option<HelmReleaseTest>,
    /// Timeout is the time to wait for any individual Kubernetes operation (like Jobs
    /// for hooks) during the performance of a Helm action. Defaults to '5m0s'.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub timeout: Option<String>,
    /// Uninstall holds the configuration for Helm uninstall actions for this HelmRelease.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub uninstall: Option<HelmReleaseUninstall>,
    /// Upgrade holds the configuration for Helm upgrade actions for this HelmRelease.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub upgrade: Option<HelmReleaseUpgrade>,
    /// Values holds the values for this Helm release.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub values: Option<serde_json::Value>,
    /// ValuesFrom holds references to resources containing Helm values for this HelmRelease,
    /// and information about how they should be merged.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "valuesFrom"
    )]
    pub values_from: Option<Vec<HelmReleaseValuesFrom>>,
    /// WaitStrategy defines Helm's wait strategy for waiting for applied
    /// resources to become ready.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "waitStrategy"
    )]
    pub wait_strategy: Option<HelmReleaseWaitStrategy>,
}

/// Chart defines the template of the v1.HelmChart that should be created
/// for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct HelmReleaseChart {
    /// ObjectMeta holds the template for metadata like labels and annotations.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub metadata: Option<HelmReleaseChartMetadata>,
    /// Spec holds the template for the v1.HelmChartSpec for this HelmRelease.
    pub spec: HelmReleaseChartSpec,
}

/// ObjectMeta holds the template for metadata like labels and annotations.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseChartMetadata {
    /// Annotations is an unstructured key value map stored with a resource that may be
    /// set by external tools to store and retrieve arbitrary metadata. They are not
    /// queryable and should be preserved when modifying objects.
    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub annotations: Option<BTreeMap<String, String>>,
    /// Map of string keys and values that can be used to organize and categorize
    /// (scope and select) objects.
    /// More info: <https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub labels: Option<BTreeMap<String, String>>,
}

/// Spec holds the template for the v1.HelmChartSpec for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct HelmReleaseChartSpec {
    /// The name or path the Helm chart is available at in the SourceRef.
    pub chart: String,
    /// IgnoreMissingValuesFiles controls whether to silently ignore missing values files rather than failing.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "ignoreMissingValuesFiles"
    )]
    pub ignore_missing_values_files: Option<bool>,
    /// Interval at which to check the v1.Source for updates. Defaults to
    /// 'HelmReleaseSpec.Interval'.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub interval: Option<String>,
    /// Determines what enables the creation of a new artifact. Valid values are
    /// ('ChartVersion', 'Revision').
    /// See the documentation of the values for an explanation on their behavior.
    /// Defaults to ChartVersion when omitted.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "reconcileStrategy"
    )]
    pub reconcile_strategy: Option<HelmReleaseChartSpecReconcileStrategy>,
    /// The name and namespace of the v1.Source the chart is available at.
    #[serde(rename = "sourceRef")]
    pub source_ref: HelmReleaseChartSpecSourceRef,
    /// Alternative list of values files to use as the chart values (values.yaml
    /// is not included by default), expected to be a relative path in the SourceRef.
    /// Values files are merged in the order of this list with the last file overriding
    /// the first. Ignored when omitted.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "valuesFiles"
    )]
    pub values_files: Option<Vec<String>>,
    /// Verify contains the secret name containing the trusted public keys
    /// used to verify the signature and specifies which provider to use to check
    /// whether OCI image is authentic.
    /// This field is only supported for OCI sources.
    /// Chart dependencies, which are not bundled in the umbrella chart artifact,
    /// are not verified.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub verify: Option<HelmReleaseChartSpecVerify>,
    /// Version semver expression, ignored for charts from v1.GitRepository and
    /// v1beta2.Bucket sources. Defaults to latest when omitted.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub version: Option<String>,
}

/// Spec holds the template for the v1.HelmChartSpec for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseChartSpecReconcileStrategy {
    ChartVersion,
    Revision,
}

/// The name and namespace of the v1.Source the chart is available at.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct HelmReleaseChartSpecSourceRef {
    /// APIVersion of the referent.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "apiVersion"
    )]
    pub api_version: Option<String>,
    /// Kind of the referent.
    pub kind: HelmReleaseChartSpecSourceRefKind,
    /// Name of the referent.
    pub name: String,
    /// Namespace of the referent.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub namespace: Option<String>,
}

/// The name and namespace of the v1.Source the chart is available at.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseChartSpecSourceRefKind {
    HelmRepository,
    GitRepository,
    Bucket,
}

/// Verify contains the secret name containing the trusted public keys
/// used to verify the signature and specifies which provider to use to check
/// whether OCI image is authentic.
/// This field is only supported for OCI sources.
/// Chart dependencies, which are not bundled in the umbrella chart artifact,
/// are not verified.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct HelmReleaseChartSpecVerify {
    /// Provider specifies the technology used to sign the OCI Helm chart.
    pub provider: HelmReleaseChartSpecVerifyProvider,
    /// SecretRef specifies the Kubernetes Secret containing the
    /// trusted public keys.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "secretRef")]
    pub secret_ref: Option<HelmReleaseChartSpecVerifySecretRef>,
}

/// Verify contains the secret name containing the trusted public keys
/// used to verify the signature and specifies which provider to use to check
/// whether OCI image is authentic.
/// This field is only supported for OCI sources.
/// Chart dependencies, which are not bundled in the umbrella chart artifact,
/// are not verified.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseChartSpecVerifyProvider {
    #[serde(rename = "cosign")]
    Cosign,
    #[serde(rename = "notation")]
    Notation,
}

/// SecretRef specifies the Kubernetes Secret containing the
/// trusted public keys.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseChartSpecVerifySecretRef {
    /// Name of the referent.
    pub name: String,
}

/// ChartRef holds a reference to a source controller resource containing the
/// Helm chart artifact.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct HelmReleaseChartRef {
    /// APIVersion of the referent.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "apiVersion"
    )]
    pub api_version: Option<String>,
    /// Kind of the referent.
    pub kind: HelmReleaseChartRefKind,
    /// Name of the referent.
    pub name: String,
    /// Namespace of the referent, defaults to the namespace of the Kubernetes
    /// resource object that contains the reference.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub namespace: Option<String>,
}

/// ChartRef holds a reference to a source controller resource containing the
/// Helm chart artifact.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseChartRefKind {
    #[serde(rename = "OCIRepository")]
    OciRepository,
    HelmChart,
    ExternalArtifact,
}

/// CommonMetadata specifies the common labels and annotations that are
/// applied to all resources. Any existing label or annotation will be
/// overridden if its key matches a common one.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseCommonMetadata {
    /// Annotations to be added to the object's metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub annotations: Option<BTreeMap<String, String>>,
    /// Labels to be added to the object's metadata.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub labels: Option<BTreeMap<String, String>>,
}

/// DependencyReference defines a HelmRelease dependency on another HelmRelease resource.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseDependsOn {
    /// Name of the referent.
    pub name: String,
    /// Namespace of the referent, defaults to the namespace of the HelmRelease
    /// resource object that contains the reference.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub namespace: Option<String>,
    /// ReadyExpr is a CEL expression that can be used to assess the readiness
    /// of a dependency. When specified, the built-in readiness check
    /// is replaced by the logic defined in the CEL expression.
    /// To make the CEL expression additive to the built-in readiness check,
    /// the feature gate `AdditiveCELDependencyCheck` must be set to `true`.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "readyExpr")]
    pub ready_expr: Option<String>,
}

/// DriftDetection holds the configuration for detecting and handling
/// differences between the manifest in the Helm storage and the resources
/// currently existing in the cluster.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseDriftDetection {
    /// Ignore contains a list of rules for specifying which changes to ignore
    /// during diffing.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub ignore: Option<Vec<HelmReleaseDriftDetectionIgnore>>,
    /// Mode defines how differences should be handled between the Helm manifest
    /// and the manifest currently applied to the cluster.
    /// If not explicitly set, it defaults to DiffModeDisabled.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub mode: Option<HelmReleaseDriftDetectionMode>,
}

/// IgnoreRule defines a rule to selectively disregard specific changes during
/// the drift detection process.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseDriftDetectionIgnore {
    /// Paths is a list of JSON Pointer (RFC 6901) paths to be excluded from
    /// consideration in a Kubernetes object.
    pub paths: Vec<String>,
    /// Target is a selector for specifying Kubernetes objects to which this
    /// rule applies.
    /// If Target is not set, the Paths will be ignored for all Kubernetes
    /// objects within the manifest of the Helm release.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub target: Option<HelmReleaseDriftDetectionIgnoreTarget>,
}

/// Target is a selector for specifying Kubernetes objects to which this
/// rule applies.
/// If Target is not set, the Paths will be ignored for all Kubernetes
/// objects within the manifest of the Helm release.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseDriftDetectionIgnoreTarget {
    /// AnnotationSelector is a string that follows the label selection expression
    /// <https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api>
    /// It matches with the resource annotations.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "annotationSelector"
    )]
    pub annotation_selector: Option<String>,
    /// Group is the API group to select resources from.
    /// Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources.
    /// <https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub group: Option<String>,
    /// Kind of the API Group to select resources from.
    /// Together with Group and Version it is capable of unambiguously
    /// identifying and/or selecting resources.
    /// <https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    /// LabelSelector is a string that follows the label selection expression
    /// <https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api>
    /// It matches with the resource labels.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "labelSelector"
    )]
    pub label_selector: Option<String>,
    /// Name to match resources with.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Namespace to select resources from.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub namespace: Option<String>,
    /// Version of the API Group to select resources from.
    /// Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources.
    /// <https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub version: Option<String>,
}

/// DriftDetection holds the configuration for detecting and handling
/// differences between the manifest in the Helm storage and the resources
/// currently existing in the cluster.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseDriftDetectionMode {
    #[serde(rename = "enabled")]
    Enabled,
    #[serde(rename = "warn")]
    Warn,
    #[serde(rename = "disabled")]
    Disabled,
}

/// CustomHealthCheck defines the health check for custom resources.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseHealthCheckExprs {
    /// APIVersion of the custom resource under evaluation.
    #[serde(rename = "apiVersion")]
    pub api_version: String,
    /// Current is the CEL expression that determines if the status
    /// of the custom resource has reached the desired state.
    pub current: String,
    /// Failed is the CEL expression that determines if the status
    /// of the custom resource has failed to reach the desired state.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub failed: Option<String>,
    /// InProgress is the CEL expression that determines if the status
    /// of the custom resource has not yet reached the desired state.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "inProgress"
    )]
    pub in_progress: Option<String>,
    /// Kind of the custom resource under evaluation.
    pub kind: String,
}

/// Install holds the configuration for Helm install actions for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseInstall {
    /// CRDs upgrade CRDs from the Helm Chart's crds directory according
    /// to the CRD upgrade policy provided here. Valid values are `Skip`,
    /// `Create` or `CreateReplace`. Default is `Create` and if omitted
    /// CRDs are installed but not updated.
    ///
    /// Skip: do neither install nor replace (update) any CRDs.
    ///
    /// Create: new CRDs are created, existing CRDs are neither updated nor deleted.
    ///
    /// CreateReplace: new CRDs are created, existing CRDs are updated (replaced)
    /// but not deleted.
    ///
    /// By default, CRDs are applied (installed) during Helm install action.
    /// With this option users can opt in to CRD replace existing CRDs on Helm
    /// install actions, which is not (yet) natively supported by Helm.
    /// <https://helm.sh/docs/chart_best_practices/custom_resource_definitions.>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub crds: Option<HelmReleaseInstallCrds>,
    /// CreateNamespace tells the Helm install action to create the
    /// HelmReleaseSpec.TargetNamespace if it does not exist yet.
    /// On uninstall, the namespace will not be garbage collected.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "createNamespace"
    )]
    pub create_namespace: Option<bool>,
    /// DisableHooks prevents hooks from running during the Helm install action.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableHooks"
    )]
    pub disable_hooks: Option<bool>,
    /// DisableOpenAPIValidation prevents the Helm install action from validating
    /// rendered templates against the Kubernetes OpenAPI Schema.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableOpenAPIValidation"
    )]
    pub disable_open_api_validation: Option<bool>,
    /// DisableSchemaValidation prevents the Helm install action from validating
    /// the values against the JSON Schema.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableSchemaValidation"
    )]
    pub disable_schema_validation: Option<bool>,
    /// DisableTakeOwnership disables taking ownership of existing resources
    /// during the Helm install action. Defaults to false.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableTakeOwnership"
    )]
    pub disable_take_ownership: Option<bool>,
    /// DisableWait disables the waiting for resources to be ready after a Helm
    /// install has been performed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableWait"
    )]
    pub disable_wait: Option<bool>,
    /// DisableWaitForJobs disables waiting for jobs to complete after a Helm
    /// install has been performed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableWaitForJobs"
    )]
    pub disable_wait_for_jobs: Option<bool>,
    /// Remediation holds the remediation configuration for when the Helm install
    /// action for the HelmRelease fails. The default is to not perform any action.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub remediation: Option<HelmReleaseInstallRemediation>,
    /// Replace tells the Helm install action to re-use the 'ReleaseName', but only
    /// if that name is a deleted release which remains in the history.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub replace: Option<bool>,
    /// ServerSideApply enables server-side apply for resources during install.
    /// Defaults to true (or false when UseHelm3Defaults feature gate is enabled).
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "serverSideApply"
    )]
    pub server_side_apply: Option<bool>,
    /// SkipCRDs tells the Helm install action to not install any CRDs. By default,
    /// CRDs are installed if not already present.
    ///
    /// Deprecated use CRD policy (`crds`) attribute with value `Skip` instead.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "skipCRDs")]
    pub skip_cr_ds: Option<bool>,
    /// Strategy defines the install strategy to use for this HelmRelease.
    /// Defaults to 'RemediateOnFailure', or 'RetryOnFailure' when the
    /// DefaultToRetryOnFailure feature gate is enabled.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub strategy: Option<HelmReleaseInstallStrategy>,
    /// Timeout is the time to wait for any individual Kubernetes operation (like
    /// Jobs for hooks) during the performance of a Helm install action. Defaults to
    /// 'HelmReleaseSpec.Timeout'.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub timeout: Option<String>,
}

/// Install holds the configuration for Helm install actions for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseInstallCrds {
    Skip,
    Create,
    CreateReplace,
}

/// Remediation holds the remediation configuration for when the Helm install
/// action for the HelmRelease fails. The default is to not perform any action.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseInstallRemediation {
    /// IgnoreTestFailures tells the controller to skip remediation when the Helm
    /// tests are run after an install action but fail. Defaults to
    /// 'Test.IgnoreFailures'.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "ignoreTestFailures"
    )]
    pub ignore_test_failures: Option<bool>,
    /// RemediateLastFailure tells the controller to remediate the last failure, when
    /// no retries remain. Defaults to 'false'.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "remediateLastFailure"
    )]
    pub remediate_last_failure: Option<bool>,
    /// Retries is the number of retries that should be attempted on failures before
    /// bailing. Remediation, using an uninstall, is performed between each attempt.
    /// Defaults to '0', a negative integer equals to unlimited retries.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub retries: Option<i64>,
}

/// Strategy defines the install strategy to use for this HelmRelease.
/// Defaults to 'RemediateOnFailure', or 'RetryOnFailure' when the
/// DefaultToRetryOnFailure feature gate is enabled.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct HelmReleaseInstallStrategy {
    /// Name of the install strategy.
    pub name: HelmReleaseInstallStrategyName,
    /// RetryInterval is the interval at which to retry a failed install.
    /// Can be used only when Name is set to RetryOnFailure.
    /// Defaults to '5m'.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "retryInterval"
    )]
    pub retry_interval: Option<String>,
}

/// Strategy defines the install strategy to use for this HelmRelease.
/// Defaults to 'RemediateOnFailure', or 'RetryOnFailure' when the
/// DefaultToRetryOnFailure feature gate is enabled.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseInstallStrategyName {
    RemediateOnFailure,
    RetryOnFailure,
}

/// KubeConfig for reconciling the HelmRelease on a remote cluster.
/// When used in combination with HelmReleaseSpec.ServiceAccountName,
/// forces the controller to act on behalf of that Service Account at the
/// target cluster.
/// If the --default-service-account flag is set, its value will be used as
/// a controller level fallback for when HelmReleaseSpec.ServiceAccountName
/// is empty.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseKubeConfig {
    /// ConfigMapRef holds an optional name of a ConfigMap that contains
    /// the following keys:
    ///
    /// - `provider`: the provider to use. One of `aws`, `azure`, `gcp`, or
    ///    `generic`. Required.
    /// - `cluster`: the fully qualified resource name of the Kubernetes
    ///    cluster in the cloud provider API. Not used by the `generic`
    ///    provider. Required when one of `address` or `ca.crt` is not set.
    /// - `address`: the address of the Kubernetes API server. Required
    ///    for `generic`. For the other providers, if not specified, the
    ///    first address in the cluster resource will be used, and if
    ///    specified, it must match one of the addresses in the cluster
    ///    resource.
    ///    If audiences is not set, will be used as the audience for the
    ///    `generic` provider.
    /// - `ca.crt`: the optional PEM-encoded CA certificate for the
    ///    Kubernetes API server. If not set, the controller will use the
    ///    CA certificate from the cluster resource.
    /// - `audiences`: the optional audiences as a list of
    ///    line-break-separated strings for the Kubernetes ServiceAccount
    ///    token. Defaults to the `address` for the `generic` provider, or
    ///    to specific values for the other providers depending on the
    ///    provider.
    /// -  `serviceAccountName`: the optional name of the Kubernetes
    ///    ServiceAccount in the same namespace that should be used
    ///    for authentication. If not specified, the controller
    ///    ServiceAccount will be used.
    ///
    /// Mutually exclusive with SecretRef.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "configMapRef"
    )]
    pub config_map_ref: Option<HelmReleaseKubeConfigConfigMapRef>,
    /// SecretRef holds an optional name of a secret that contains a key with
    /// the kubeconfig file as the value. If no key is set, the key will default
    /// to 'value'. Mutually exclusive with ConfigMapRef.
    /// It is recommended that the kubeconfig is self-contained, and the secret
    /// is regularly updated if credentials such as a cloud-access-token expire.
    /// Cloud specific `cmd-path` auth helpers will not function without adding
    /// binaries and credentials to the Pod that is responsible for reconciling
    /// Kubernetes resources. Supported only for the generic provider.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "secretRef")]
    pub secret_ref: Option<HelmReleaseKubeConfigSecretRef>,
}

/// ConfigMapRef holds an optional name of a ConfigMap that contains
/// the following keys:
///
/// - `provider`: the provider to use. One of `aws`, `azure`, `gcp`, or
///    `generic`. Required.
/// - `cluster`: the fully qualified resource name of the Kubernetes
///    cluster in the cloud provider API. Not used by the `generic`
///    provider. Required when one of `address` or `ca.crt` is not set.
/// - `address`: the address of the Kubernetes API server. Required
///    for `generic`. For the other providers, if not specified, the
///    first address in the cluster resource will be used, and if
///    specified, it must match one of the addresses in the cluster
///    resource.
///    If audiences is not set, will be used as the audience for the
///    `generic` provider.
/// - `ca.crt`: the optional PEM-encoded CA certificate for the
///    Kubernetes API server. If not set, the controller will use the
///    CA certificate from the cluster resource.
/// - `audiences`: the optional audiences as a list of
///    line-break-separated strings for the Kubernetes ServiceAccount
///    token. Defaults to the `address` for the `generic` provider, or
///    to specific values for the other providers depending on the
///    provider.
/// -  `serviceAccountName`: the optional name of the Kubernetes
///    ServiceAccount in the same namespace that should be used
///    for authentication. If not specified, the controller
///    ServiceAccount will be used.
///
/// Mutually exclusive with SecretRef.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseKubeConfigConfigMapRef {
    /// Name of the referent.
    pub name: String,
}

/// SecretRef holds an optional name of a secret that contains a key with
/// the kubeconfig file as the value. If no key is set, the key will default
/// to 'value'. Mutually exclusive with ConfigMapRef.
/// It is recommended that the kubeconfig is self-contained, and the secret
/// is regularly updated if credentials such as a cloud-access-token expire.
/// Cloud specific `cmd-path` auth helpers will not function without adding
/// binaries and credentials to the Pod that is responsible for reconciling
/// Kubernetes resources. Supported only for the generic provider.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseKubeConfigSecretRef {
    /// Key in the Secret, when not specified an implementation-specific default key is used.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub key: Option<String>,
    /// Name of the Secret.
    pub name: String,
}

/// PostRenderer contains a Helm PostRenderer specification.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleasePostRenderers {
    /// Kustomization to apply as PostRenderer.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub kustomize: Option<HelmReleasePostRenderersKustomize>,
}

/// Kustomization to apply as PostRenderer.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleasePostRenderersKustomize {
    /// Images is a list of (image name, new name, new tag or digest)
    /// for changing image names, tags or digests. This can also be achieved with a
    /// patch, but this operator is simpler to specify.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub images: Option<Vec<HelmReleasePostRenderersKustomizeImages>>,
    /// Strategic merge and JSON patches, defined as inline YAML objects,
    /// capable of targeting objects based on kind, label and annotation selectors.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub patches: Option<Vec<HelmReleasePostRenderersKustomizePatches>>,
}

/// Image contains an image name, a new name, a new tag or digest, which will replace the original name and tag.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleasePostRenderersKustomizeImages {
    /// Digest is the value used to replace the original image tag.
    /// If digest is present NewTag value is ignored.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub digest: Option<String>,
    /// Name is a tag-less image name.
    pub name: String,
    /// NewName is the value used to replace the original name.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "newName")]
    pub new_name: Option<String>,
    /// NewTag is the value used to replace the original tag.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "newTag")]
    pub new_tag: Option<String>,
}

/// Patch contains an inline StrategicMerge or JSON6902 patch, and the target the patch should
/// be applied to.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleasePostRenderersKustomizePatches {
    /// Patch contains an inline StrategicMerge patch or an inline JSON6902 patch with
    /// an array of operation objects.
    pub patch: String,
    /// Target points to the resources that the patch document should be applied to.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub target: Option<HelmReleasePostRenderersKustomizePatchesTarget>,
}

/// Target points to the resources that the patch document should be applied to.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleasePostRenderersKustomizePatchesTarget {
    /// AnnotationSelector is a string that follows the label selection expression
    /// <https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api>
    /// It matches with the resource annotations.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "annotationSelector"
    )]
    pub annotation_selector: Option<String>,
    /// Group is the API group to select resources from.
    /// Together with Version and Kind it is capable of unambiguously identifying and/or selecting resources.
    /// <https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub group: Option<String>,
    /// Kind of the API Group to select resources from.
    /// Together with Group and Version it is capable of unambiguously
    /// identifying and/or selecting resources.
    /// <https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub kind: Option<String>,
    /// LabelSelector is a string that follows the label selection expression
    /// <https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api>
    /// It matches with the resource labels.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "labelSelector"
    )]
    pub label_selector: Option<String>,
    /// Name to match resources with.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Namespace to select resources from.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub namespace: Option<String>,
    /// Version of the API Group to select resources from.
    /// Together with Group and Kind it is capable of unambiguously identifying and/or selecting resources.
    /// <https://github.com/kubernetes/community/blob/master/contributors/design-proposals/api-machinery/api-group.md>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub version: Option<String>,
}

/// Rollback holds the configuration for Helm rollback actions for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseRollback {
    /// CleanupOnFail allows deletion of new resources created during the Helm
    /// rollback action when it fails.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "cleanupOnFail"
    )]
    pub cleanup_on_fail: Option<bool>,
    /// DisableHooks prevents hooks from running during the Helm rollback action.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableHooks"
    )]
    pub disable_hooks: Option<bool>,
    /// DisableWait disables the waiting for resources to be ready after a Helm
    /// rollback has been performed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableWait"
    )]
    pub disable_wait: Option<bool>,
    /// DisableWaitForJobs disables waiting for jobs to complete after a Helm
    /// rollback has been performed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableWaitForJobs"
    )]
    pub disable_wait_for_jobs: Option<bool>,
    /// Force forces resource updates through a replacement strategy
    /// that avoids 3-way merge conflicts on client-side apply.
    /// This field is ignored for server-side apply (which always
    /// forces conflicts with other field managers).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub force: Option<bool>,
    /// Recreate performs pod restarts for any managed workloads.
    ///
    /// Deprecated: This behavior was deprecated in Helm 3:
    ///   - Deprecation: <https://github.com/helm/helm/pull/6463>
    ///   - Removal: <https://github.com/helm/helm/pull/31023>
    /// After helm-controller was upgraded to the Helm 4 SDK,
    /// this field is no longer functional and will print a
    /// warning if set to true. It will also be removed in a
    /// future release.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub recreate: Option<bool>,
    /// ServerSideApply enables server-side apply for resources during rollback.
    /// Can be "enabled", "disabled", or "auto".
    /// When "auto", server-side apply usage will be based on the release's previous usage.
    /// Defaults to "auto".
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "serverSideApply"
    )]
    pub server_side_apply: Option<HelmReleaseRollbackServerSideApply>,
    /// Timeout is the time to wait for any individual Kubernetes operation (like
    /// Jobs for hooks) during the performance of a Helm rollback action. Defaults to
    /// 'HelmReleaseSpec.Timeout'.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub timeout: Option<String>,
}

/// Rollback holds the configuration for Helm rollback actions for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseRollbackServerSideApply {
    #[serde(rename = "enabled")]
    Enabled,
    #[serde(rename = "disabled")]
    Disabled,
    #[serde(rename = "auto")]
    Auto,
}

/// Test holds the configuration for Helm test actions for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseTest {
    /// Enable enables Helm test actions for this HelmRelease after an Helm install
    /// or upgrade action has been performed.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub enable: Option<bool>,
    /// Filters is a list of tests to run or exclude from running.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub filters: Option<Vec<HelmReleaseTestFilters>>,
    /// IgnoreFailures tells the controller to skip remediation when the Helm tests
    /// are run but fail. Can be overwritten for tests run after install or upgrade
    /// actions in 'Install.IgnoreTestFailures' and 'Upgrade.IgnoreTestFailures'.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "ignoreFailures"
    )]
    pub ignore_failures: Option<bool>,
    /// Timeout is the time to wait for any individual Kubernetes operation during
    /// the performance of a Helm test action. Defaults to 'HelmReleaseSpec.Timeout'.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub timeout: Option<String>,
}

/// Filter holds the configuration for individual Helm test filters.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseTestFilters {
    /// Exclude specifies whether the named test should be excluded.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub exclude: Option<bool>,
    /// Name is the name of the test.
    pub name: String,
}

/// Uninstall holds the configuration for Helm uninstall actions for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseUninstall {
    /// DeletionPropagation specifies the deletion propagation policy when
    /// a Helm uninstall is performed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "deletionPropagation"
    )]
    pub deletion_propagation: Option<HelmReleaseUninstallDeletionPropagation>,
    /// DisableHooks prevents hooks from running during the Helm rollback action.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableHooks"
    )]
    pub disable_hooks: Option<bool>,
    /// DisableWait disables waiting for all the resources to be deleted after
    /// a Helm uninstall is performed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableWait"
    )]
    pub disable_wait: Option<bool>,
    /// KeepHistory tells Helm to remove all associated resources and mark the
    /// release as deleted, but retain the release history.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "keepHistory"
    )]
    pub keep_history: Option<bool>,
    /// Timeout is the time to wait for any individual Kubernetes operation (like
    /// Jobs for hooks) during the performance of a Helm uninstall action. Defaults
    /// to 'HelmReleaseSpec.Timeout'.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub timeout: Option<String>,
}

/// Uninstall holds the configuration for Helm uninstall actions for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseUninstallDeletionPropagation {
    #[serde(rename = "background")]
    Background,
    #[serde(rename = "foreground")]
    Foreground,
    #[serde(rename = "orphan")]
    Orphan,
}

/// Upgrade holds the configuration for Helm upgrade actions for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseUpgrade {
    /// CleanupOnFail allows deletion of new resources created during the Helm
    /// upgrade action when it fails.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "cleanupOnFail"
    )]
    pub cleanup_on_fail: Option<bool>,
    /// CRDs upgrade CRDs from the Helm Chart's crds directory according
    /// to the CRD upgrade policy provided here. Valid values are `Skip`,
    /// `Create` or `CreateReplace`. Default is `Skip` and if omitted
    /// CRDs are neither installed nor upgraded.
    ///
    /// Skip: do neither install nor replace (update) any CRDs.
    ///
    /// Create: new CRDs are created, existing CRDs are neither updated nor deleted.
    ///
    /// CreateReplace: new CRDs are created, existing CRDs are updated (replaced)
    /// but not deleted.
    ///
    /// By default, CRDs are not applied during Helm upgrade action. With this
    /// option users can opt-in to CRD upgrade, which is not (yet) natively supported by Helm.
    /// <https://helm.sh/docs/chart_best_practices/custom_resource_definitions.>
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub crds: Option<HelmReleaseUpgradeCrds>,
    /// DisableHooks prevents hooks from running during the Helm upgrade action.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableHooks"
    )]
    pub disable_hooks: Option<bool>,
    /// DisableOpenAPIValidation prevents the Helm upgrade action from validating
    /// rendered templates against the Kubernetes OpenAPI Schema.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableOpenAPIValidation"
    )]
    pub disable_open_api_validation: Option<bool>,
    /// DisableSchemaValidation prevents the Helm upgrade action from validating
    /// the values against the JSON Schema.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableSchemaValidation"
    )]
    pub disable_schema_validation: Option<bool>,
    /// DisableTakeOwnership disables taking ownership of existing resources
    /// during the Helm upgrade action. Defaults to false.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableTakeOwnership"
    )]
    pub disable_take_ownership: Option<bool>,
    /// DisableWait disables the waiting for resources to be ready after a Helm
    /// upgrade has been performed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableWait"
    )]
    pub disable_wait: Option<bool>,
    /// DisableWaitForJobs disables waiting for jobs to complete after a Helm
    /// upgrade has been performed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "disableWaitForJobs"
    )]
    pub disable_wait_for_jobs: Option<bool>,
    /// Force forces resource updates through a replacement strategy
    /// that avoids 3-way merge conflicts on client-side apply.
    /// This field is ignored for server-side apply (which always
    /// forces conflicts with other field managers).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub force: Option<bool>,
    /// PreserveValues will make Helm reuse the last release's values and merge in
    /// overrides from 'Values'. Setting this flag makes the HelmRelease
    /// non-declarative.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "preserveValues"
    )]
    pub preserve_values: Option<bool>,
    /// Remediation holds the remediation configuration for when the Helm upgrade
    /// action for the HelmRelease fails. The default is to not perform any action.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub remediation: Option<HelmReleaseUpgradeRemediation>,
    /// ServerSideApply enables server-side apply for resources during upgrade.
    /// Can be "enabled", "disabled", or "auto".
    /// When "auto", server-side apply usage will be based on the release's previous usage.
    /// Defaults to "auto".
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "serverSideApply"
    )]
    pub server_side_apply: Option<HelmReleaseUpgradeServerSideApply>,
    /// Strategy defines the upgrade strategy to use for this HelmRelease.
    /// Defaults to 'RemediateOnFailure', or 'RetryOnFailure' when the
    /// DefaultToRetryOnFailure feature gate is enabled.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub strategy: Option<HelmReleaseUpgradeStrategy>,
    /// Timeout is the time to wait for any individual Kubernetes operation (like
    /// Jobs for hooks) during the performance of a Helm upgrade action. Defaults to
    /// 'HelmReleaseSpec.Timeout'.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub timeout: Option<String>,
}

/// Upgrade holds the configuration for Helm upgrade actions for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseUpgradeCrds {
    Skip,
    Create,
    CreateReplace,
}

/// Remediation holds the remediation configuration for when the Helm upgrade
/// action for the HelmRelease fails. The default is to not perform any action.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseUpgradeRemediation {
    /// IgnoreTestFailures tells the controller to skip remediation when the Helm
    /// tests are run after an upgrade action but fail.
    /// Defaults to 'Test.IgnoreFailures'.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "ignoreTestFailures"
    )]
    pub ignore_test_failures: Option<bool>,
    /// RemediateLastFailure tells the controller to remediate the last failure, when
    /// no retries remain. Defaults to 'false' unless 'Retries' is greater than 0.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "remediateLastFailure"
    )]
    pub remediate_last_failure: Option<bool>,
    /// Retries is the number of retries that should be attempted on failures before
    /// bailing. Remediation, using 'Strategy', is performed between each attempt.
    /// Defaults to '0', a negative integer equals to unlimited retries.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub retries: Option<i64>,
    /// Strategy to use for failure remediation. Defaults to 'rollback'.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub strategy: Option<HelmReleaseUpgradeRemediationStrategy>,
}

/// Remediation holds the remediation configuration for when the Helm upgrade
/// action for the HelmRelease fails. The default is to not perform any action.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseUpgradeRemediationStrategy {
    #[serde(rename = "rollback")]
    Rollback,
    #[serde(rename = "uninstall")]
    Uninstall,
}

/// Upgrade holds the configuration for Helm upgrade actions for this HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseUpgradeServerSideApply {
    #[serde(rename = "enabled")]
    Enabled,
    #[serde(rename = "disabled")]
    Disabled,
    #[serde(rename = "auto")]
    Auto,
}

/// Strategy defines the upgrade strategy to use for this HelmRelease.
/// Defaults to 'RemediateOnFailure', or 'RetryOnFailure' when the
/// DefaultToRetryOnFailure feature gate is enabled.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct HelmReleaseUpgradeStrategy {
    /// Name of the upgrade strategy.
    pub name: HelmReleaseUpgradeStrategyName,
    /// RetryInterval is the interval at which to retry a failed upgrade.
    /// Can be used only when Name is set to RetryOnFailure.
    /// Defaults to '5m'.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "retryInterval"
    )]
    pub retry_interval: Option<String>,
}

/// Strategy defines the upgrade strategy to use for this HelmRelease.
/// Defaults to 'RemediateOnFailure', or 'RetryOnFailure' when the
/// DefaultToRetryOnFailure feature gate is enabled.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseUpgradeStrategyName {
    RemediateOnFailure,
    RetryOnFailure,
}

/// ValuesReference contains a reference to a resource containing Helm values,
/// and optionally the key they can be found at.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct HelmReleaseValuesFrom {
    /// Kind of the values referent, valid values are ('Secret', 'ConfigMap').
    pub kind: HelmReleaseValuesFromKind,
    /// Name of the values referent. Should reside in the same namespace as the
    /// referring resource.
    pub name: String,
    /// Optional marks this ValuesReference as optional. When set, a not found error
    /// for the values reference is ignored, but any ValuesKey, TargetPath or
    /// transient error will still result in a reconciliation failure.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub optional: Option<bool>,
    /// TargetPath is the YAML dot notation path the value should be merged at. When
    /// set, the ValuesKey is expected to be a single flat value. Defaults to 'None',
    /// which results in the values getting merged at the root.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "targetPath"
    )]
    pub target_path: Option<String>,
    /// ValuesKey is the data key where the values.yaml or a specific value can be
    /// found at. Defaults to 'values.yaml'.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "valuesKey")]
    pub values_key: Option<String>,
}

/// ValuesReference contains a reference to a resource containing Helm values,
/// and optionally the key they can be found at.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseValuesFromKind {
    Secret,
    ConfigMap,
}

/// WaitStrategy defines Helm's wait strategy for waiting for applied
/// resources to become ready.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct HelmReleaseWaitStrategy {
    /// Name is Helm's wait strategy for waiting for applied resources to
    /// become ready. One of 'poller' or 'legacy'. The 'poller' strategy uses
    /// kstatus to poll resource statuses, while the 'legacy' strategy uses
    /// Helm v3's waiting logic.
    /// Defaults to 'poller', or to 'legacy' when UseHelm3Defaults feature
    /// gate is enabled.
    pub name: HelmReleaseWaitStrategyName,
}

/// WaitStrategy defines Helm's wait strategy for waiting for applied
/// resources to become ready.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseWaitStrategyName {
    #[serde(rename = "poller")]
    Poller,
    #[serde(rename = "legacy")]
    Legacy,
}

/// HelmReleaseStatus defines the observed state of a HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseStatus {
    /// Conditions holds the conditions for the HelmRelease.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub conditions: Option<Vec<Condition>>,
    /// Failures is the reconciliation failure count against the latest desired
    /// state. It is reset after a successful reconciliation.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub failures: Option<i64>,
    /// HelmChart is the namespaced name of the HelmChart resource created by
    /// the controller for the HelmRelease.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "helmChart")]
    pub helm_chart: Option<String>,
    /// History holds the history of Helm releases performed for this HelmRelease
    /// up to the last successfully completed release.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub history: Option<Vec<HelmReleaseStatusHistory>>,
    /// InstallFailures is the install failure count against the latest desired
    /// state. It is reset after a successful reconciliation.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "installFailures"
    )]
    pub install_failures: Option<i64>,
    /// Inventory contains the list of Kubernetes resource object references
    /// that have been applied for this release.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub inventory: Option<HelmReleaseStatusInventory>,
    /// LastAttemptedConfigDigest is the digest for the config (better known as
    /// "values") of the last reconciliation attempt.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastAttemptedConfigDigest"
    )]
    pub last_attempted_config_digest: Option<String>,
    /// LastAttemptedGeneration is the last generation the controller attempted
    /// to reconcile.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastAttemptedGeneration"
    )]
    pub last_attempted_generation: Option<i64>,
    /// LastAttemptedReleaseAction is the last release action performed for this
    /// HelmRelease. It is used to determine the active retry or remediation
    /// strategy.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastAttemptedReleaseAction"
    )]
    pub last_attempted_release_action: Option<HelmReleaseStatusLastAttemptedReleaseAction>,
    /// LastAttemptedReleaseActionDuration is the duration of the last
    /// release action performed for this HelmRelease.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastAttemptedReleaseActionDuration"
    )]
    pub last_attempted_release_action_duration: Option<String>,
    /// LastAttemptedRevision is the Source revision of the last reconciliation
    /// attempt. For OCIRepository  sources, the 12 first characters of the digest are
    /// appended to the chart version e.g. "1.2.3+1234567890ab".
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastAttemptedRevision"
    )]
    pub last_attempted_revision: Option<String>,
    /// LastAttemptedRevisionDigest is the digest of the last reconciliation attempt.
    /// This is only set for OCIRepository sources.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastAttemptedRevisionDigest"
    )]
    pub last_attempted_revision_digest: Option<String>,
    /// LastAttemptedValuesChecksum is the SHA1 checksum for the values of the last
    /// reconciliation attempt.
    ///
    /// Deprecated: Use LastAttemptedConfigDigest instead.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastAttemptedValuesChecksum"
    )]
    pub last_attempted_values_checksum: Option<String>,
    /// LastHandledForceAt holds the value of the most recent
    /// force request value, so a change of the annotation value
    /// can be detected.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastHandledForceAt"
    )]
    pub last_handled_force_at: Option<String>,
    /// LastHandledReconcileAt holds the value of the most recent
    /// reconcile request value, so a change of the annotation value
    /// can be detected.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastHandledReconcileAt"
    )]
    pub last_handled_reconcile_at: Option<String>,
    /// LastHandledResetAt holds the value of the most recent reset request
    /// value, so a change of the annotation value can be detected.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastHandledResetAt"
    )]
    pub last_handled_reset_at: Option<String>,
    /// LastReleaseRevision is the revision of the last successful Helm release.
    ///
    /// Deprecated: Use History instead.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastReleaseRevision"
    )]
    pub last_release_revision: Option<i64>,
    /// ObservedCommonMetadataDigest is the digest for the common metadata of
    /// the last successful reconciliation attempt.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "observedCommonMetadataDigest"
    )]
    pub observed_common_metadata_digest: Option<String>,
    /// ObservedGeneration is the last observed generation.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "observedGeneration"
    )]
    pub observed_generation: Option<i64>,
    /// ObservedPostRenderersDigest is the digest for the post-renderers of
    /// the last successful reconciliation attempt.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "observedPostRenderersDigest"
    )]
    pub observed_post_renderers_digest: Option<String>,
    /// StorageNamespace is the namespace of the Helm release storage for the
    /// current release.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "storageNamespace"
    )]
    pub storage_namespace: Option<String>,
    /// UpgradeFailures is the upgrade failure count against the latest desired
    /// state. It is reset after a successful reconciliation.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "upgradeFailures"
    )]
    pub upgrade_failures: Option<i64>,
}

/// Snapshot captures a point-in-time copy of the status information for a Helm release,
/// as managed by the controller.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseStatusHistory {
    /// Action is the action that resulted in this snapshot being created.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub action: Option<String>,
    /// APIVersion is the API version of the Snapshot.
    /// When the calculation method of the Digest field is changed, this
    /// field will be used to distinguish between the old and new methods.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "apiVersion"
    )]
    pub api_version: Option<String>,
    /// AppVersion is the chart app version of the release object in storage.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "appVersion"
    )]
    pub app_version: Option<String>,
    /// ChartName is the chart name of the release object in storage.
    #[serde(rename = "chartName")]
    pub chart_name: String,
    /// ChartVersion is the chart version of the release object in
    /// storage.
    #[serde(rename = "chartVersion")]
    pub chart_version: String,
    /// ConfigDigest is the checksum of the config (better known as
    /// "values") of the release object in storage.
    /// It has the format of `<algo>:<checksum>`.
    #[serde(rename = "configDigest")]
    pub config_digest: String,
    /// Deleted is when the release was deleted.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub deleted: Option<String>,
    /// Digest is the checksum of the release object in storage.
    /// It has the format of `<algo>:<checksum>`.
    pub digest: String,
    /// FirstDeployed is when the release was first deployed.
    #[serde(rename = "firstDeployed")]
    pub first_deployed: String,
    /// LastDeployed is when the release was last deployed.
    #[serde(rename = "lastDeployed")]
    pub last_deployed: String,
    /// Name is the name of the release.
    pub name: String,
    /// Namespace is the namespace the release is deployed to.
    pub namespace: String,
    /// OCIDigest is the digest of the OCI artifact associated with the release.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "ociDigest")]
    pub oci_digest: Option<String>,
    /// Status is the current state of the release.
    pub status: String,
    /// TestHooks is the list of test hooks for the release as observed to be
    /// run by the controller.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "testHooks")]
    pub test_hooks: Option<BTreeMap<String, HelmReleaseStatusHistoryTestHooks>>,
    /// Version is the version of the release object in storage.
    pub version: i64,
}

/// TestHooks is the list of test hooks for the release as observed to be
/// run by the controller.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseStatusHistoryTestHooks {
    /// LastCompleted is the time the test hook last completed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastCompleted"
    )]
    pub last_completed: Option<String>,
    /// LastStarted is the time the test hook was last started.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "lastStarted"
    )]
    pub last_started: Option<String>,
    /// Phase the test hook was observed to be in.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub phase: Option<String>,
}

/// Inventory contains the list of Kubernetes resource object references
/// that have been applied for this release.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseStatusInventory {
    /// Entries of Kubernetes resource object references.
    pub entries: Vec<HelmReleaseStatusInventoryEntries>,
}

/// ResourceRef contains the information necessary to locate a resource within a cluster.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct HelmReleaseStatusInventoryEntries {
    /// ID is the string representation of the Kubernetes resource object's metadata,
    /// in the format '<namespace>_<name>_<group>_<kind>'.
    pub id: String,
    /// Version is the API version of the Kubernetes resource object's kind.
    pub v: String,
}

/// HelmReleaseStatus defines the observed state of a HelmRelease.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum HelmReleaseStatusLastAttemptedReleaseAction {
    #[serde(rename = "install")]
    Install,
    #[serde(rename = "upgrade")]
    Upgrade,
}
