authentik-client 2026.2.3

Making authentication simple.
Documentation
/*
 * authentik
 *
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.2.3
 * Contact: hello@goauthentik.io
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// LifecycleRule : Mixin to validate that a valid enterprise license exists before allowing to save the object
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct LifecycleRule {
    #[serde(rename = "id")]
    pub id: uuid::Uuid,
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "content_type")]
    pub content_type: models::ContentTypeEnum,
    #[serde(
        rename = "object_id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub object_id: Option<Option<String>>,
    #[serde(rename = "interval", skip_serializing_if = "Option::is_none")]
    pub interval: Option<String>,
    #[serde(rename = "grace_period", skip_serializing_if = "Option::is_none")]
    pub grace_period: Option<String>,
    #[serde(rename = "reviewer_groups", skip_serializing_if = "Option::is_none")]
    pub reviewer_groups: Option<Vec<uuid::Uuid>>,
    #[serde(rename = "reviewer_groups_obj")]
    pub reviewer_groups_obj: Vec<models::ReviewerGroup>,
    #[serde(rename = "min_reviewers", skip_serializing_if = "Option::is_none")]
    pub min_reviewers: Option<u16>,
    #[serde(rename = "min_reviewers_is_per_group", skip_serializing_if = "Option::is_none")]
    pub min_reviewers_is_per_group: Option<bool>,
    #[serde(rename = "reviewers")]
    pub reviewers: Vec<uuid::Uuid>,
    #[serde(rename = "reviewers_obj")]
    pub reviewers_obj: Vec<models::ReviewerUser>,
    /// Select which transports should be used to notify the reviewers. If none are selected, the notification will only be shown in the authentik UI.
    #[serde(rename = "notification_transports", skip_serializing_if = "Option::is_none")]
    pub notification_transports: Option<Vec<uuid::Uuid>>,
    #[serde(rename = "target_verbose")]
    pub target_verbose: String,
}

impl LifecycleRule {
    /// Mixin to validate that a valid enterprise license exists before allowing to save the object
    pub fn new(
        id: uuid::Uuid,
        name: String,
        content_type: models::ContentTypeEnum,
        reviewer_groups_obj: Vec<models::ReviewerGroup>,
        reviewers: Vec<uuid::Uuid>,
        reviewers_obj: Vec<models::ReviewerUser>,
        target_verbose: String,
    ) -> LifecycleRule {
        LifecycleRule {
            id,
            name,
            content_type,
            object_id: None,
            interval: None,
            grace_period: None,
            reviewer_groups: None,
            reviewer_groups_obj,
            min_reviewers: None,
            min_reviewers_is_per_group: None,
            reviewers,
            reviewers_obj,
            notification_transports: None,
            target_verbose,
        }
    }
}