/* 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 { SeverityEnum } from "./SeverityEnum";
import { SeverityEnumFromJSON, SeverityEnumToJSON } from "./SeverityEnum";

/**
 * NotificationRule Serializer
 * @export
 * @interface NotificationRuleRequest
 */
export interface NotificationRuleRequest {
    /**
     *
     * @type {string}
     * @memberof NotificationRuleRequest
     */
    name: string;
    /**
     * Select which transports should be used to notify the user. If none are selected, the notification will only be shown in the authentik UI.
     * @type {Array<string>}
     * @memberof NotificationRuleRequest
     */
    transports?: Array<string>;
    /**
     * Controls which severity level the created notifications will have.
     * @type {SeverityEnum}
     * @memberof NotificationRuleRequest
     */
    severity?: SeverityEnum;
    /**
     * Define which group of users this notification should be sent and shown to. If left empty, Notification won't ben sent.
     * @type {string}
     * @memberof NotificationRuleRequest
     */
    destinationGroup?: string | null;
    /**
     * When enabled, notification will be sent to user the user that triggered the event.When destination_group is configured, notification is sent to both.
     * @type {boolean}
     * @memberof NotificationRuleRequest
     */
    destinationEventUser?: boolean;
}

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

export function NotificationRuleRequestFromJSON(json: any): NotificationRuleRequest {
    return NotificationRuleRequestFromJSONTyped(json, false);
}

export function NotificationRuleRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): NotificationRuleRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"],
        transports: json["transports"] == null ? undefined : json["transports"],
        severity: json["severity"] == null ? undefined : SeverityEnumFromJSON(json["severity"]),
        destinationGroup: json["destination_group"] == null ? undefined : json["destination_group"],
        destinationEventUser:
            json["destination_event_user"] == null ? undefined : json["destination_event_user"],
    };
}

export function NotificationRuleRequestToJSON(json: any): NotificationRuleRequest {
    return NotificationRuleRequestToJSONTyped(json, false);
}

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

    return {
        name: value["name"],
        transports: value["transports"],
        severity: SeverityEnumToJSON(value["severity"]),
        destination_group: value["destinationGroup"],
        destination_event_user: value["destinationEventUser"],
    };
}
