/* 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 { DeliveryMethodEnum } from "./DeliveryMethodEnum";
import { DeliveryMethodEnumFromJSON, DeliveryMethodEnumToJSON } from "./DeliveryMethodEnum";
import type { EventsRequestedEnum } from "./EventsRequestedEnum";
import { EventsRequestedEnumFromJSON, EventsRequestedEnumToJSON } from "./EventsRequestedEnum";
import type { SSFProvider } from "./SSFProvider";
import { SSFProviderFromJSON } from "./SSFProvider";
import type { SSFStreamStatusEnum } from "./SSFStreamStatusEnum";
import { SSFStreamStatusEnumFromJSON, SSFStreamStatusEnumToJSON } from "./SSFStreamStatusEnum";

/**
 * SSFStream Serializer
 * @export
 * @interface SSFStream
 */
export interface SSFStream {
    /**
     *
     * @type {string}
     * @memberof SSFStream
     */
    readonly pk: string;
    /**
     *
     * @type {SSFStreamStatusEnum}
     * @memberof SSFStream
     */
    status?: SSFStreamStatusEnum;
    /**
     *
     * @type {number}
     * @memberof SSFStream
     */
    provider: number;
    /**
     *
     * @type {SSFProvider}
     * @memberof SSFStream
     */
    readonly providerObj: SSFProvider;
    /**
     *
     * @type {DeliveryMethodEnum}
     * @memberof SSFStream
     */
    deliveryMethod: DeliveryMethodEnum;
    /**
     *
     * @type {string}
     * @memberof SSFStream
     */
    endpointUrl?: string | null;
    /**
     *
     * @type {Array<EventsRequestedEnum>}
     * @memberof SSFStream
     */
    eventsRequested?: Array<EventsRequestedEnum>;
    /**
     *
     * @type {string}
     * @memberof SSFStream
     */
    format: string;
    /**
     *
     * @type {Array<string>}
     * @memberof SSFStream
     */
    aud?: Array<string>;
    /**
     *
     * @type {string}
     * @memberof SSFStream
     */
    iss: string;
}

/**
 * Check if a given object implements the SSFStream interface.
 */
export function instanceOfSSFStream(value: object): value is SSFStream {
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("provider" in value) || value["provider"] === undefined) return false;
    if (!("providerObj" in value) || value["providerObj"] === undefined) return false;
    if (!("deliveryMethod" in value) || value["deliveryMethod"] === undefined) return false;
    if (!("format" in value) || value["format"] === undefined) return false;
    if (!("iss" in value) || value["iss"] === undefined) return false;
    return true;
}

export function SSFStreamFromJSON(json: any): SSFStream {
    return SSFStreamFromJSONTyped(json, false);
}

export function SSFStreamFromJSONTyped(json: any, ignoreDiscriminator: boolean): SSFStream {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        status: json["status"] == null ? undefined : SSFStreamStatusEnumFromJSON(json["status"]),
        provider: json["provider"],
        providerObj: SSFProviderFromJSON(json["provider_obj"]),
        deliveryMethod: DeliveryMethodEnumFromJSON(json["delivery_method"]),
        endpointUrl: json["endpoint_url"] == null ? undefined : json["endpoint_url"],
        eventsRequested:
            json["events_requested"] == null
                ? undefined
                : (json["events_requested"] as Array<any>).map(EventsRequestedEnumFromJSON),
        format: json["format"],
        aud: json["aud"] == null ? undefined : json["aud"],
        iss: json["iss"],
    };
}

export function SSFStreamToJSON(json: any): SSFStream {
    return SSFStreamToJSONTyped(json, false);
}

export function SSFStreamToJSONTyped(
    value?: Omit<SSFStream, "pk" | "provider_obj"> | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        status: SSFStreamStatusEnumToJSON(value["status"]),
        provider: value["provider"],
        delivery_method: DeliveryMethodEnumToJSON(value["deliveryMethod"]),
        endpoint_url: value["endpointUrl"],
        events_requested:
            value["eventsRequested"] == null
                ? undefined
                : (value["eventsRequested"] as Array<any>).map(EventsRequestedEnumToJSON),
        format: value["format"],
        aud: value["aud"],
        iss: value["iss"],
    };
}
