/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.10.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 { mapValues } from '../runtime';
import type { Group } from './Group';
import {
    GroupFromJSON,
    GroupFromJSONTyped,
    GroupToJSON,
    GroupToJSONTyped,
} from './Group';
import type { SeverityEnum } from './SeverityEnum';
import {
    SeverityEnumFromJSON,
    SeverityEnumFromJSONTyped,
    SeverityEnumToJSON,
    SeverityEnumToJSONTyped,
} from './SeverityEnum';

/**
 * NotificationRule Serializer
 * @export
 * @interface NotificationRule
 */
export interface NotificationRule {
    /**
     * 
     * @type {string}
     * @memberof NotificationRule
     */
    readonly pk: string;
    /**
     * 
     * @type {string}
     * @memberof NotificationRule
     */
    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 NotificationRule
     */
    transports?: Array<string>;
    /**
     * Controls which severity level the created notifications will have.
     * @type {SeverityEnum}
     * @memberof NotificationRule
     */
    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 NotificationRule
     */
    destinationGroup?: string | null;
    /**
     * 
     * @type {Group}
     * @memberof NotificationRule
     */
    readonly destinationGroupObj: Group;
    /**
     * 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 NotificationRule
     */
    destinationEventUser?: boolean;
}



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

export function NotificationRuleFromJSON(json: any): NotificationRule {
    return NotificationRuleFromJSONTyped(json, false);
}

export function NotificationRuleFromJSONTyped(json: any, ignoreDiscriminator: boolean): NotificationRule {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        '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'],
        'destinationGroupObj': GroupFromJSON(json['destination_group_obj']),
        'destinationEventUser': json['destination_event_user'] == null ? undefined : json['destination_event_user'],
    };
}

export function NotificationRuleToJSON(json: any): NotificationRule {
    return NotificationRuleToJSONTyped(json, false);
}

export function NotificationRuleToJSONTyped(value?: Omit<NotificationRule, 'pk'|'destination_group_obj'> | 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'],
    };
}

