/* 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 { TransportModeEnum } from "./TransportModeEnum";
import { TransportModeEnumFromJSON, TransportModeEnumToJSON } from "./TransportModeEnum";

/**
 * NotificationTransport Serializer
 * @export
 * @interface NotificationTransportRequest
 */
export interface NotificationTransportRequest {
    /**
     *
     * @type {string}
     * @memberof NotificationTransportRequest
     */
    name: string;
    /**
     *
     * @type {TransportModeEnum}
     * @memberof NotificationTransportRequest
     */
    mode?: TransportModeEnum;
    /**
     *
     * @type {string}
     * @memberof NotificationTransportRequest
     */
    webhookUrl?: string;
    /**
     * When set, the selected ceritifcate is used to validate the certificate of the webhook server.
     * @type {string}
     * @memberof NotificationTransportRequest
     */
    webhookCa?: string | null;
    /**
     * Customize the body of the request. Mapping should return data that is JSON-serializable.
     * @type {string}
     * @memberof NotificationTransportRequest
     */
    webhookMappingBody?: string | null;
    /**
     * Configure additional headers to be sent. Mapping should return a dictionary of key-value pairs
     * @type {string}
     * @memberof NotificationTransportRequest
     */
    webhookMappingHeaders?: string | null;
    /**
     *
     * @type {string}
     * @memberof NotificationTransportRequest
     */
    emailSubjectPrefix?: string;
    /**
     *
     * @type {string}
     * @memberof NotificationTransportRequest
     */
    emailTemplate?: string;
    /**
     * Only send notification once, for example when sending a webhook into a chat channel.
     * @type {boolean}
     * @memberof NotificationTransportRequest
     */
    sendOnce?: boolean;
}

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

export function NotificationTransportRequestFromJSON(json: any): NotificationTransportRequest {
    return NotificationTransportRequestFromJSONTyped(json, false);
}

export function NotificationTransportRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): NotificationTransportRequest {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"],
        mode: json["mode"] == null ? undefined : TransportModeEnumFromJSON(json["mode"]),
        webhookUrl: json["webhook_url"] == null ? undefined : json["webhook_url"],
        webhookCa: json["webhook_ca"] == null ? undefined : json["webhook_ca"],
        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 NotificationTransportRequestToJSON(json: any): NotificationTransportRequest {
    return NotificationTransportRequestToJSONTyped(json, false);
}

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

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