/* tslint:disable */
/* eslint-disable */
/**
 * Streaming Availability API
 * Streaming Availability API allows getting streaming availability information of movies and series; and querying the list of available shows on streaming services such as Netflix, Disney+, Apple TV, Max and Hulu across 60 countries!
 *
 * The version of the OpenAPI document: 4.1.0
 * 
 *
 * 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 { Addon } from './Addon';
import {
    AddonFromJSON,
    AddonFromJSONTyped,
    AddonToJSON,
} from './Addon';
import type { Locale } from './Locale';
import {
    LocaleFromJSON,
    LocaleFromJSONTyped,
    LocaleToJSON,
} from './Locale';
import type { Price } from './Price';
import {
    PriceFromJSON,
    PriceFromJSONTyped,
    PriceToJSON,
} from './Price';
import type { ServiceInfo } from './ServiceInfo';
import {
    ServiceInfoFromJSON,
    ServiceInfoFromJSONTyped,
    ServiceInfoToJSON,
} from './ServiceInfo';
import type { StreamingOptionType } from './StreamingOptionType';
import {
    StreamingOptionTypeFromJSON,
    StreamingOptionTypeFromJSONTyped,
    StreamingOptionTypeToJSON,
} from './StreamingOptionType';
import type { Subtitle } from './Subtitle';
import {
    SubtitleFromJSON,
    SubtitleFromJSONTyped,
    SubtitleToJSON,
} from './Subtitle';

/**
 * A streaming option.
 * @export
 * @interface StreamingOption
 */
export interface StreamingOption {
    /**
     * 
     * @type {ServiceInfo}
     * @memberof StreamingOption
     */
    service: ServiceInfo;
    /**
     * 
     * @type {StreamingOptionType}
     * @memberof StreamingOption
     */
    type: StreamingOptionType;
    /**
     * Addon that the streaming option is available through.
     * Omitted if the streaming option is not available through an addon.
     * 
     * @type {Addon}
     * @memberof StreamingOption
     */
    addon?: Addon;
    /**
     * Deep link to the streaming option's page in the web app of the streaming service.
     * Unlike videoLink, this field is guaranteed to be populated.
     * 
     * @type {string}
     * @memberof StreamingOption
     */
    link: string;
    /**
     * Deep link to the video associated with the streaming option.
     * Omitted if there's no direct link to the video.
     * Might have the same value as link.
     * 
     * @type {string}
     * @memberof StreamingOption
     */
    videoLink?: string;
    /**
     * Maximum supported video quality of the streaming option.
     * @type {string}
     * @memberof StreamingOption
     */
    quality?: StreamingOptionQualityEnum;
    /**
     * Array of the available audios.
     * @type {Array<Locale>}
     * @memberof StreamingOption
     */
    audios: Array<Locale>;
    /**
     * Array of the available subtitles.
     * @type {Array<Subtitle>}
     * @memberof StreamingOption
     */
    subtitles: Array<Subtitle>;
    /**
     * 
     * @type {Price}
     * @memberof StreamingOption
     */
    price?: Price;
    /**
     * Whether the streaming option expires within a month.
     * @type {boolean}
     * @memberof StreamingOption
     */
    expiresSoon: boolean;
    /**
     * [Unix Time Stamp](https://www.unixtimestamp.com/) of the date that the streaming option is expiring.
     * In other words, last day to watch.
     * 
     * @type {number}
     * @memberof StreamingOption
     */
    expiresOn?: number;
    /**
     * [Unix Time Stamp](https://www.unixtimestamp.com/) of the date that this streaming option was detected.
     * 
     * @type {number}
     * @memberof StreamingOption
     */
    availableSince: number;
}


/**
 * @export
 */
export const StreamingOptionQualityEnum = {
    Sd: 'sd',
    Hd: 'hd',
    Qhd: 'qhd',
    Uhd: 'uhd'
} as const;
export type StreamingOptionQualityEnum = typeof StreamingOptionQualityEnum[keyof typeof StreamingOptionQualityEnum];


/**
 * Check if a given object implements the StreamingOption interface.
 */
export function instanceOfStreamingOption(value: object): boolean {
    if (!('service' in value)) return false;
    if (!('type' in value)) return false;
    if (!('link' in value)) return false;
    if (!('audios' in value)) return false;
    if (!('subtitles' in value)) return false;
    if (!('expiresSoon' in value)) return false;
    if (!('availableSince' in value)) return false;
    return true;
}

export function StreamingOptionFromJSON(json: any): StreamingOption {
    return StreamingOptionFromJSONTyped(json, false);
}

export function StreamingOptionFromJSONTyped(json: any, ignoreDiscriminator: boolean): StreamingOption {
    if (json == null) {
        return json;
    }
    return {
        
        'service': ServiceInfoFromJSON(json['service']),
        'type': StreamingOptionTypeFromJSON(json['type']),
        'addon': json['addon'] == null ? undefined : AddonFromJSON(json['addon']),
        'link': json['link'],
        'videoLink': json['videoLink'] == null ? undefined : json['videoLink'],
        'quality': json['quality'] == null ? undefined : json['quality'],
        'audios': ((json['audios'] as Array<any>).map(LocaleFromJSON)),
        'subtitles': ((json['subtitles'] as Array<any>).map(SubtitleFromJSON)),
        'price': json['price'] == null ? undefined : PriceFromJSON(json['price']),
        'expiresSoon': json['expiresSoon'],
        'expiresOn': json['expiresOn'] == null ? undefined : json['expiresOn'],
        'availableSince': json['availableSince'],
    };
}

export function StreamingOptionToJSON(value?: StreamingOption | null): any {
    if (value == null) {
        return value;
    }
    return {
        
        'service': ServiceInfoToJSON(value['service']),
        'type': StreamingOptionTypeToJSON(value['type']),
        'addon': AddonToJSON(value['addon']),
        'link': value['link'],
        'videoLink': value['videoLink'],
        'quality': value['quality'],
        'audios': ((value['audios'] as Array<any>).map(LocaleToJSON)),
        'subtitles': ((value['subtitles'] as Array<any>).map(SubtitleToJSON)),
        'price': PriceToJSON(value['price']),
        'expiresSoon': value['expiresSoon'],
        'expiresOn': value['expiresOn'],
        'availableSince': value['availableSince'],
    };
}

