/* 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 { NotificationTransportModeEnum } from './NotificationTransportModeEnum';
import {
    NotificationTransportModeEnumFromJSON,
    NotificationTransportModeEnumFromJSONTyped,
    NotificationTransportModeEnumToJSON,
    NotificationTransportModeEnumToJSONTyped,
} from './NotificationTransportModeEnum';

/**
 * NotificationTransport Serializer
 * @export
 * @interface NotificationTransport
 */
export interface NotificationTransport {
    /**
     * 
     * @type {string}
     * @memberof NotificationTransport
     */
    readonly pk: string;
    /**
     * 
     * @type {string}
     * @memberof NotificationTransport
     */
    name: string;
    /**
     * 
     * @type {NotificationTransportModeEnum}
     * @memberof NotificationTransport
     */
    mode?: NotificationTransportModeEnum;
    /**
     * Return selected mode with a UI Label
     * @type {string}
     * @memberof NotificationTransport
     */
    readonly modeVerbose: string;
    /**
     * 
     * @type {string}
     * @memberof NotificationTransport
     */
    webhookUrl?: string;
    /**
     * Customize the body of the request. Mapping should return data that is JSON-serializable.
     * @type {string}
     * @memberof NotificationTransport
     */
    webhookMappingBody?: string | null;
    /**
     * Configure additional headers to be sent. Mapping should return a dictionary of key-value pairs
     * @type {string}
     * @memberof NotificationTransport
     */
    webhookMappingHeaders?: string | null;
    /**
     * 
     * @type {string}
     * @memberof NotificationTransport
     */
    emailSubjectPrefix?: string;
    /**
     * 
     * @type {string}
     * @memberof NotificationTransport
     */
    emailTemplate?: string;
    /**
     * Only send notification once, for example when sending a webhook into a chat channel.
     * @type {boolean}
     * @memberof NotificationTransport
     */
    sendOnce?: boolean;
}



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

export function NotificationTransportFromJSON(json: any): NotificationTransport {
    return NotificationTransportFromJSONTyped(json, false);
}

export function NotificationTransportFromJSONTyped(json: any, ignoreDiscriminator: boolean): NotificationTransport {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        'name': json['name'],
        'mode': json['mode'] == null ? undefined : NotificationTransportModeEnumFromJSON(json['mode']),
        'modeVerbose': json['mode_verbose'],
        'webhookUrl': json['webhook_url'] == null ? undefined : json['webhook_url'],
        'webhookMappingBody': json['webhook_mapping_body'] == null ? undefined : json['webhook_mapping_body'],
        'webhookMappingHeaders': json['webhook_mapping_headers'] == null ? undefined : json['webhook_mapping_headers'],
        'emailSubjectPrefix': json['email_subject_prefix'] == null ? undefined : json['email_subject_prefix'],
        'emailTemplate': json['email_template'] == null ? undefined : json['email_template'],
        'sendOnce': json['send_once'] == null ? undefined : json['send_once'],
    };
}

export function NotificationTransportToJSON(json: any): NotificationTransport {
    return NotificationTransportToJSONTyped(json, false);
}

export function NotificationTransportToJSONTyped(value?: Omit<NotificationTransport, 'pk'|'mode_verbose'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'name': value['name'],
        'mode': NotificationTransportModeEnumToJSON(value['mode']),
        'webhook_url': value['webhookUrl'],
        'webhook_mapping_body': value['webhookMappingBody'],
        'webhook_mapping_headers': value['webhookMappingHeaders'],
        'email_subject_prefix': value['emailSubjectPrefix'],
        'email_template': value['emailTemplate'],
        'send_once': value['sendOnce'],
    };
}

