//! Auto-generated models for notification-controller
//! Generated from: notification-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.C2wbBaSTyG/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::*;

/// AlertSpec defines an alerting rule for events involving a list of objects.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
#[kube(
    group = "notification.toolkit.fluxcd.io",
    version = "v1beta3",
    kind = "Alert",
    plural = "alerts"
)]
#[kube(namespaced)]
#[kube(schema = "disabled")]
#[kube(derive = "Default")]
#[kube(derive = "PartialEq")]
pub struct AlertSpec {
    /// EventMetadata is an optional field for adding metadata to events dispatched by the
    /// controller. This can be used for enhancing the context of the event. If a field
    /// would override one already present on the original event as generated by the emitter,
    /// then the override doesn't happen, i.e. the original value is preserved, and an info
    /// log is printed.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "eventMetadata"
    )]
    pub event_metadata: Option<BTreeMap<String, String>>,
    /// EventSeverity specifies how to filter events based on severity.
    /// If set to 'info' no events will be filtered.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "eventSeverity"
    )]
    pub event_severity: Option<AlertEventSeverity>,
    /// EventSources specifies how to filter events based
    /// on the involved object kind, name and namespace.
    #[serde(rename = "eventSources")]
    pub event_sources: Vec<AlertEventSources>,
    /// ExclusionList specifies a list of Golang regular expressions
    /// to be used for excluding messages.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "exclusionList"
    )]
    pub exclusion_list: Option<Vec<String>>,
    /// InclusionList specifies a list of Golang regular expressions
    /// to be used for including messages.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "inclusionList"
    )]
    pub inclusion_list: Option<Vec<String>>,
    /// ProviderRef specifies which Provider this Alert should use.
    #[serde(rename = "providerRef")]
    pub provider_ref: AlertProviderRef,
    /// Summary holds a short description of the impact and affected cluster.
    /// Deprecated: Use EventMetadata instead.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub summary: Option<String>,
    /// Suspend tells the controller to suspend subsequent
    /// events handling for this Alert.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub suspend: Option<bool>,
}

/// AlertSpec defines an alerting rule for events involving a list of objects.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum AlertEventSeverity {
    #[serde(rename = "info")]
    Info,
    #[serde(rename = "error")]
    Error,
}

/// CrossNamespaceObjectReference contains enough information to let you locate the
/// typed referenced object at cluster level
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct AlertEventSources {
    /// API version of the referent
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "apiVersion"
    )]
    pub api_version: Option<String>,
    /// Kind of the referent
    pub kind: AlertEventSourcesKind,
    /// MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
    /// MatchLabels requires the name to be set to `*`.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "matchLabels"
    )]
    pub match_labels: Option<BTreeMap<String, String>>,
    /// Name of the referent
    /// If multiple resources are targeted `*` may be set.
    pub name: String,
    /// Namespace of the referent
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub namespace: Option<String>,
}

/// CrossNamespaceObjectReference contains enough information to let you locate the
/// typed referenced object at cluster level
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum AlertEventSourcesKind {
    Bucket,
    GitRepository,
    Kustomization,
    HelmRelease,
    HelmChart,
    HelmRepository,
    ImageRepository,
    ImagePolicy,
    ImageUpdateAutomation,
    #[serde(rename = "OCIRepository")]
    OciRepository,
    ArtifactGenerator,
    ExternalArtifact,
}

/// ProviderRef specifies which Provider this Alert should use.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct AlertProviderRef {
    /// Name of the referent.
    pub name: String,
}

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

#[allow(unused_imports)]
use self::prelude::*;

/// ProviderSpec defines the desired state of the Provider.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, PartialEq)]
#[kube(
    group = "notification.toolkit.fluxcd.io",
    version = "v1beta3",
    kind = "Provider",
    plural = "providers"
)]
#[kube(namespaced)]
#[kube(schema = "disabled")]
#[kube(derive = "PartialEq")]
pub struct ProviderSpec {
    /// Address specifies the endpoint, in a generic sense, to where alerts are sent.
    /// What kind of endpoint depends on the specific Provider type being used.
    /// For the generic Provider, for example, this is an HTTP/S address.
    /// For other Provider types this could be a project ID or a namespace.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub address: Option<String>,
    /// CertSecretRef specifies the Secret containing TLS certificates
    /// for secure communication.
    ///
    /// Supported configurations:
    /// - CA-only: Server authentication (provide ca.crt only)
    /// - mTLS: Mutual authentication (provide ca.crt + tls.crt + tls.key)
    /// - Client-only: Client authentication with system CA (provide tls.crt + tls.key only)
    ///
    /// Legacy keys "caFile", "certFile", "keyFile" are supported but deprecated. Use "ca.crt", "tls.crt", "tls.key" instead.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "certSecretRef"
    )]
    pub cert_secret_ref: Option<ProviderCertSecretRef>,
    /// Channel specifies the destination channel where events should be posted.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub channel: Option<String>,
    /// CommitStatusExpr is a CEL expression that evaluates to a string value
    /// that can be used to generate a custom commit status message for use
    /// with eligible Provider types (github, gitlab, gitea, bitbucketserver,
    /// bitbucket, azuredevops). Supported variables are: event, provider,
    /// and alert.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "commitStatusExpr"
    )]
    pub commit_status_expr: Option<String>,
    /// Interval at which to reconcile the Provider with its Secret references.
    /// Deprecated and not used in v1beta3.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub interval: Option<String>,
    /// Proxy the HTTP/S address of the proxy server.
    /// Deprecated: Use ProxySecretRef instead. Will be removed in v1.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub proxy: Option<String>,
    /// ProxySecretRef specifies the Secret containing the proxy configuration
    /// for this Provider. The Secret should contain an 'address' key with the
    /// HTTP/S address of the proxy server. Optional 'username' and 'password'
    /// keys can be provided for proxy authentication.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "proxySecretRef"
    )]
    pub proxy_secret_ref: Option<ProviderProxySecretRef>,
    /// SecretRef specifies the Secret containing the authentication
    /// credentials for this Provider.
    #[serde(default, skip_serializing_if = "Option::is_none", rename = "secretRef")]
    pub secret_ref: Option<ProviderSecretRef>,
    /// ServiceAccountName is the name of the Kubernetes ServiceAccount used to
    /// authenticate with cloud provider services through workload identity.
    /// This enables multi-tenant authentication without storing static credentials.
    ///
    /// Supported provider types: azureeventhub, azuredevops, googlepubsub
    ///
    /// When specified, the controller will:
    /// 1. Create an OIDC token for the specified ServiceAccount
    /// 2. Exchange it for cloud provider credentials via STS
    /// 3. Use the obtained credentials for API authentication
    ///
    /// When unspecified, controller-level authentication is used (single-tenant).
    ///
    /// An error is thrown if static credentials are also defined in SecretRef.
    /// This field requires the ObjectLevelWorkloadIdentity feature gate to be enabled.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "serviceAccountName"
    )]
    pub service_account_name: Option<String>,
    /// Suspend tells the controller to suspend subsequent
    /// events handling for this Provider.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub suspend: Option<bool>,
    /// Timeout for sending alerts to the Provider.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub timeout: Option<String>,
    /// Type specifies which Provider implementation to use.
    #[serde(rename = "type")]
    pub r#type: ProviderType,
    /// Username specifies the name under which events are posted.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub username: Option<String>,
}

/// CertSecretRef specifies the Secret containing TLS certificates
/// for secure communication.
///
/// Supported configurations:
/// - CA-only: Server authentication (provide ca.crt only)
/// - mTLS: Mutual authentication (provide ca.crt + tls.crt + tls.key)
/// - Client-only: Client authentication with system CA (provide tls.crt + tls.key only)
///
/// Legacy keys "caFile", "certFile", "keyFile" are supported but deprecated. Use "ca.crt", "tls.crt", "tls.key" instead.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ProviderCertSecretRef {
    /// Name of the referent.
    pub name: String,
}

/// ProxySecretRef specifies the Secret containing the proxy configuration
/// for this Provider. The Secret should contain an 'address' key with the
/// HTTP/S address of the proxy server. Optional 'username' and 'password'
/// keys can be provided for proxy authentication.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ProviderProxySecretRef {
    /// Name of the referent.
    pub name: String,
}

/// SecretRef specifies the Secret containing the authentication
/// credentials for this Provider.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ProviderSecretRef {
    /// Name of the referent.
    pub name: String,
}

/// ProviderSpec defines the desired state of the Provider.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum ProviderType {
    #[serde(rename = "slack")]
    Slack,
    #[serde(rename = "discord")]
    Discord,
    #[serde(rename = "msteams")]
    Msteams,
    #[serde(rename = "rocket")]
    Rocket,
    #[serde(rename = "generic")]
    Generic,
    #[serde(rename = "generic-hmac")]
    GenericHmac,
    #[serde(rename = "github")]
    Github,
    #[serde(rename = "gitlab")]
    Gitlab,
    #[serde(rename = "gitea")]
    Gitea,
    #[serde(rename = "giteapullrequestcomment")]
    Giteapullrequestcomment,
    #[serde(rename = "bitbucketserver")]
    Bitbucketserver,
    #[serde(rename = "bitbucket")]
    Bitbucket,
    #[serde(rename = "azuredevops")]
    Azuredevops,
    #[serde(rename = "googlechat")]
    Googlechat,
    #[serde(rename = "googlepubsub")]
    Googlepubsub,
    #[serde(rename = "webex")]
    Webex,
    #[serde(rename = "sentry")]
    Sentry,
    #[serde(rename = "azureeventhub")]
    Azureeventhub,
    #[serde(rename = "telegram")]
    Telegram,
    #[serde(rename = "lark")]
    Lark,
    #[serde(rename = "matrix")]
    Matrix,
    #[serde(rename = "opsgenie")]
    Opsgenie,
    #[serde(rename = "alertmanager")]
    Alertmanager,
    #[serde(rename = "grafana")]
    Grafana,
    #[serde(rename = "githubdispatch")]
    Githubdispatch,
    #[serde(rename = "githubpullrequestcomment")]
    Githubpullrequestcomment,
    #[serde(rename = "gitlabmergerequestcomment")]
    Gitlabmergerequestcomment,
    #[serde(rename = "pagerduty")]
    Pagerduty,
    #[serde(rename = "datadog")]
    Datadog,
    #[serde(rename = "nats")]
    Nats,
    #[serde(rename = "zulip")]
    Zulip,
    #[serde(rename = "otel")]
    Otel,
}

// ---

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

#[allow(unused_imports)]
use self::prelude::*;

/// ReceiverSpec defines the desired state of the Receiver.
#[derive(CustomResource, Serialize, Deserialize, Clone, Debug, PartialEq)]
#[kube(
    group = "notification.toolkit.fluxcd.io",
    version = "v1",
    kind = "Receiver",
    plural = "receivers"
)]
#[kube(namespaced)]
#[kube(status = "ReceiverStatus")]
#[kube(schema = "disabled")]
#[kube(derive = "PartialEq")]
pub struct ReceiverSpec {
    /// Events specifies the list of event types to handle,
    /// e.g. 'push' for GitHub or 'Push Hook' for GitLab.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub events: Option<Vec<String>>,
    /// Interval at which to reconcile the Receiver with its Secret references.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub interval: Option<String>,
    /// ResourceFilter is a CEL expression expected to return a boolean that is
    /// evaluated for each resource referenced in the Resources field when a
    /// webhook is received. If the expression returns false then the controller
    /// will not request a reconciliation for the resource.
    /// When the expression is specified the controller will parse it and mark
    /// the object as terminally failed if the expression is invalid or does not
    /// return a boolean.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "resourceFilter"
    )]
    pub resource_filter: Option<String>,
    /// A list of resources to be notified about changes.
    pub resources: Vec<ReceiverResources>,
    /// SecretRef specifies the Secret containing the token used
    /// to validate the payload authenticity. The Secret must contain a 'token'
    /// key. For GCR receivers, the Secret must also contain an 'email' key
    /// with the IAM service account email configured on the Pub/Sub push
    /// subscription, and an 'audience' key with the expected OIDC token audience.
    #[serde(rename = "secretRef")]
    pub secret_ref: ReceiverSecretRef,
    /// Suspend tells the controller to suspend subsequent
    /// events handling for this receiver.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub suspend: Option<bool>,
    /// Type of webhook sender, used to determine
    /// the validation procedure and payload deserialization.
    #[serde(rename = "type")]
    pub r#type: ReceiverType,
}

/// CrossNamespaceObjectReference contains enough information to let you locate the
/// typed referenced object at cluster level
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct ReceiverResources {
    /// API version of the referent
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "apiVersion"
    )]
    pub api_version: Option<String>,
    /// Kind of the referent
    pub kind: ReceiverResourcesKind,
    /// MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
    /// map is equivalent to an element of matchExpressions, whose key field is "key", the
    /// operator is "In", and the values array contains only "value". The requirements are ANDed.
    /// MatchLabels requires the name to be set to `*`.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "matchLabels"
    )]
    pub match_labels: Option<BTreeMap<String, String>>,
    /// Name of the referent
    /// If multiple resources are targeted `*` may be set.
    pub name: String,
    /// Namespace of the referent
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub namespace: Option<String>,
}

/// CrossNamespaceObjectReference contains enough information to let you locate the
/// typed referenced object at cluster level
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum ReceiverResourcesKind {
    Bucket,
    GitRepository,
    Kustomization,
    HelmRelease,
    HelmChart,
    HelmRepository,
    ImageRepository,
    ImagePolicy,
    ImageUpdateAutomation,
    #[serde(rename = "OCIRepository")]
    OciRepository,
    ArtifactGenerator,
    ExternalArtifact,
}

/// SecretRef specifies the Secret containing the token used
/// to validate the payload authenticity. The Secret must contain a 'token'
/// key. For GCR receivers, the Secret must also contain an 'email' key
/// with the IAM service account email configured on the Pub/Sub push
/// subscription, and an 'audience' key with the expected OIDC token audience.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ReceiverSecretRef {
    /// Name of the referent.
    pub name: String,
}

/// ReceiverSpec defines the desired state of the Receiver.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub enum ReceiverType {
    #[serde(rename = "generic")]
    Generic,
    #[serde(rename = "generic-hmac")]
    GenericHmac,
    #[serde(rename = "github")]
    Github,
    #[serde(rename = "gitlab")]
    Gitlab,
    #[serde(rename = "bitbucket")]
    Bitbucket,
    #[serde(rename = "harbor")]
    Harbor,
    #[serde(rename = "dockerhub")]
    Dockerhub,
    #[serde(rename = "quay")]
    Quay,
    #[serde(rename = "gcr")]
    Gcr,
    #[serde(rename = "nexus")]
    Nexus,
    #[serde(rename = "acr")]
    Acr,
    #[serde(rename = "cdevents")]
    Cdevents,
}

/// ReceiverStatus defines the observed state of the Receiver.
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct ReceiverStatus {
    /// Conditions holds the conditions for the Receiver.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub conditions: Option<Vec<Condition>>,
    /// 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>,
    /// ObservedGeneration is the last observed generation of the Receiver object.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "observedGeneration"
    )]
    pub observed_generation: Option<i64>,
    /// WebhookPath is the generated incoming webhook address in the format
    /// of '/hook/sha256sum(token+name+namespace)'.
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        rename = "webhookPath"
    )]
    pub webhook_path: Option<String>,
}

// ---
