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

/**
 * Notification Serializer
 * @export
 * @interface Notification
 */
export interface Notification {
    /**
     *
     * @type {string}
     * @memberof Notification
     */
    readonly pk: string;
    /**
     *
     * @type {SeverityEnum}
     * @memberof Notification
     */
    readonly severity: SeverityEnum;
    /**
     *
     * @type {string}
     * @memberof Notification
     */
    readonly body: string;
    /**
     *
     * @type {string}
     * @memberof Notification
     */
    hyperlink?: string | null;
    /**
     *
     * @type {string}
     * @memberof Notification
     */
    hyperlinkLabel?: string | null;
    /**
     *
     * @type {Date}
     * @memberof Notification
     */
    readonly created: Date;
    /**
     *
     * @type {Event}
     * @memberof Notification
     */
    event?: Event;
    /**
     *
     * @type {boolean}
     * @memberof Notification
     */
    seen?: boolean;
}

/**
 * Check if a given object implements the Notification interface.
 */
export function instanceOfNotification(value: object): value is Notification {
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("severity" in value) || value["severity"] === undefined) return false;
    if (!("body" in value) || value["body"] === undefined) return false;
    if (!("created" in value) || value["created"] === undefined) return false;
    return true;
}

export function NotificationFromJSON(json: any): Notification {
    return NotificationFromJSONTyped(json, false);
}

export function NotificationFromJSONTyped(json: any, ignoreDiscriminator: boolean): Notification {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        severity: SeverityEnumFromJSON(json["severity"]),
        body: json["body"],
        hyperlink: json["hyperlink"] == null ? undefined : json["hyperlink"],
        hyperlinkLabel: json["hyperlink_label"] == null ? undefined : json["hyperlink_label"],
        created: new Date(json["created"]),
        event: json["event"] == null ? undefined : EventFromJSON(json["event"]),
        seen: json["seen"] == null ? undefined : json["seen"],
    };
}

export function NotificationToJSON(json: any): Notification {
    return NotificationToJSONTyped(json, false);
}

export function NotificationToJSONTyped(
    value?: Omit<Notification, "pk" | "severity" | "body" | "created"> | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        hyperlink: value["hyperlink"],
        hyperlink_label: value["hyperlinkLabel"],
        event: EventToJSON(value["event"]),
        seen: value["seen"],
    };
}
