/* tslint:disable */
/* eslint-disable */
/**
 * Commander Spellbook API
 * API for Commander Spellbook, the combo database engine for Magic: The Gathering
 *
 * The version of the OpenAPI document: 5.4.10
 * 
 *
 * 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.js';
import type { CardInDeck } from './CardInDeck.js';
import {
    CardInDeckFromJSON,
    CardInDeckFromJSONTyped,
    CardInDeckToJSON,
    CardInDeckToJSONTyped,
} from './CardInDeck.js';

/**
 * 
 * @export
 * @interface Deck
 */
export interface Deck {
    /**
     * 
     * @type {Array<CardInDeck>}
     * @memberof Deck
     */
    main: Array<CardInDeck>;
    /**
     * 
     * @type {Array<CardInDeck>}
     * @memberof Deck
     */
    commanders: Array<CardInDeck>;
}

/**
 * Check if a given object implements the Deck interface.
 */
export function instanceOfDeck(value: object): value is Deck {
    if (!('main' in value) || value['main'] === undefined) return false;
    if (!('commanders' in value) || value['commanders'] === undefined) return false;
    return true;
}

export function DeckFromJSON(json: any): Deck {
    return DeckFromJSONTyped(json, false);
}

export function DeckFromJSONTyped(json: any, ignoreDiscriminator: boolean): Deck {
    if (json == null) {
        return json;
    }
    return {
        
        'main': ((json['main'] as Array<any>).map(CardInDeckFromJSON)),
        'commanders': ((json['commanders'] as Array<any>).map(CardInDeckFromJSON)),
    };
}

export function DeckToJSON(json: any): Deck {
    return DeckToJSONTyped(json, false);
}

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

    return {
        
        'main': ((value['main'] as Array<any>).map(CardInDeckToJSON)),
        'commanders': ((value['commanders'] as Array<any>).map(CardInDeckToJSON)),
    };
}

