/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.5.0-rc1
 * Contact: hello@goauthentik.io
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import type { ContentTypeEnum } from "./ContentTypeEnum";
import { ContentTypeEnumFromJSON, ContentTypeEnumToJSON } from "./ContentTypeEnum";

/**
 * Mixin to validate that a valid enterprise license
 * exists before allowing to save the object
 * @export
 * @interface LifecycleRuleRequest
 */
export interface LifecycleRuleRequest {
    /**
     *
     * @type {string}
     * @memberof LifecycleRuleRequest
     */
    name: string;
    /**
     *
     * @type {ContentTypeEnum}
     * @memberof LifecycleRuleRequest
     */
    contentType: ContentTypeEnum;
    /**
     *
     * @type {string}
     * @memberof LifecycleRuleRequest
     */
    objectId?: string | null;
    /**
     *
     * @type {string}
     * @memberof LifecycleRuleRequest
     */
    interval?: string;
    /**
     *
     * @type {string}
     * @memberof LifecycleRuleRequest
     */
    gracePeriod?: string;
    /**
     *
     * @type {Array<string>}
     * @memberof LifecycleRuleRequest
     */
    reviewerGroups?: Array<string>;
    /**
     *
     * @type {number}
     * @memberof LifecycleRuleRequest
     */
    minReviewers?: number;
    /**
     *
     * @type {boolean}
     * @memberof LifecycleRuleRequest
     */
    minReviewersIsPerGroup?: boolean;
    /**
     *
     * @type {Array<string>}
     * @memberof LifecycleRuleRequest
     */
    reviewers: Array<string>;
    /**
     * Select which transports should be used to notify the reviewers. If none are selected, the notification will only be shown in the authentik UI.
     * @type {Array<string>}
     * @memberof LifecycleRuleRequest
     */
    notificationTransports?: Array<string>;
}

/**
 * Check if a given object implements the LifecycleRuleRequest interface.
 */
export function instanceOfLifecycleRuleRequest(value: object): value is LifecycleRuleRequest {
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("contentType" in value) || value["contentType"] === undefined) return false;
    if (!("reviewers" in value) || value["reviewers"] === undefined) return false;
    return true;
}

export function LifecycleRuleRequestFromJSON(json: any): LifecycleRuleRequest {
    return LifecycleRuleRequestFromJSONTyped(json, false);
}

export function LifecycleRuleRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): LifecycleRuleRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"],
        contentType: ContentTypeEnumFromJSON(json["content_type"]),
        objectId: json["object_id"] == null ? undefined : json["object_id"],
        interval: json["interval"] == null ? undefined : json["interval"],
        gracePeriod: json["grace_period"] == null ? undefined : json["grace_period"],
        reviewerGroups: json["reviewer_groups"] == null ? undefined : json["reviewer_groups"],
        minReviewers: json["min_reviewers"] == null ? undefined : json["min_reviewers"],
        minReviewersIsPerGroup:
            json["min_reviewers_is_per_group"] == null
                ? undefined
                : json["min_reviewers_is_per_group"],
        reviewers: json["reviewers"],
        notificationTransports:
            json["notification_transports"] == null ? undefined : json["notification_transports"],
    };
}

export function LifecycleRuleRequestToJSON(json: any): LifecycleRuleRequest {
    return LifecycleRuleRequestToJSONTyped(json, false);
}

export function LifecycleRuleRequestToJSONTyped(
    value?: LifecycleRuleRequest | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        name: value["name"],
        content_type: ContentTypeEnumToJSON(value["contentType"]),
        object_id: value["objectId"],
        interval: value["interval"],
        grace_period: value["gracePeriod"],
        reviewer_groups: value["reviewerGroups"],
        min_reviewers: value["minReviewers"],
        min_reviewers_is_per_group: value["minReviewersIsPerGroup"],
        reviewers: value["reviewers"],
        notification_transports: value["notificationTransports"],
    };
}
