/* 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 59 countries!
 *
 * The version of the OpenAPI document: 3.3.1
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { exists, mapValues } from '../runtime';
import type { Episode } from './Episode';
import {
    EpisodeFromJSON,
    EpisodeFromJSONTyped,
    EpisodeToJSON,
} from './Episode';
import type { StreamingOption } from './StreamingOption';
import {
    StreamingOptionFromJSON,
    StreamingOptionFromJSONTyped,
    StreamingOptionToJSON,
} from './StreamingOption';

/**
 * Details of a season.
 * @export
 * @interface Season
 */
export interface Season {
    /**
     * Type of the item. Always "season".
     * @type {string}
     * @memberof Season
     */
    type: SeasonTypeEnum;
    /**
     * Title of the season.
     * @type {string}
     * @memberof Season
     */
    title: string;
    /**
     * The first year that the season aired.
     * @type {number}
     * @memberof Season
     */
    firstAirYear: number;
    /**
     * The last year that the season aired.
     * @type {number}
     * @memberof Season
     */
    lastAirYear: number;
    /**
     * Country to streaming availability info mapping of a show.
     * @type {{ [key: string]: Array<StreamingOption>; }}
     * @memberof Season
     */
    streamingInfo: { [key: string]: Array<StreamingOption>; };
    /**
     * Array of the episodes belong to the season.
     * @type {Array<Episode>}
     * @memberof Season
     */
    episodes: Array<Episode>;
}


/**
 * @export
 */
export const SeasonTypeEnum = {
    Season: 'season'
} as const;
export type SeasonTypeEnum = typeof SeasonTypeEnum[keyof typeof SeasonTypeEnum];


/**
 * Check if a given object implements the Season interface.
 */
export function instanceOfSeason(value: object): boolean {
    let isInstance = true;
    isInstance = isInstance && "type" in value;
    isInstance = isInstance && "title" in value;
    isInstance = isInstance && "firstAirYear" in value;
    isInstance = isInstance && "lastAirYear" in value;
    isInstance = isInstance && "streamingInfo" in value;
    isInstance = isInstance && "episodes" in value;

    return isInstance;
}

export function SeasonFromJSON(json: any): Season {
    return SeasonFromJSONTyped(json, false);
}

export function SeasonFromJSONTyped(json: any, ignoreDiscriminator: boolean): Season {
    if ((json === undefined) || (json === null)) {
        return json;
    }
    return {
        
        'type': json['type'],
        'title': json['title'],
        'firstAirYear': json['firstAirYear'],
        'lastAirYear': json['lastAirYear'],
        'streamingInfo': json['streamingInfo'],
        'episodes': ((json['episodes'] as Array<any>).map(EpisodeFromJSON)),
    };
}

export function SeasonToJSON(value?: Season | null): any {
    if (value === undefined) {
        return undefined;
    }
    if (value === null) {
        return null;
    }
    return {
        
        'type': value.type,
        'title': value.title,
        'firstAirYear': value.firstAirYear,
        'lastAirYear': value.lastAirYear,
        'streamingInfo': value.streamingInfo,
        'episodes': ((value.episodes as Array<any>).map(EpisodeToJSON)),
    };
}

