/* 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: 4.2.2
 * 
 *
 * 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 { Feature } from './feature';
import {
    FeatureFromJSON,
    FeatureFromJSONTyped,
    FeatureToJSON,
    FeatureToJSONTyped,
} from './feature';

/**
 * 
 * @export
 * @interface FeatureOfCard
 */
export interface FeatureOfCard {
    /**
     * 
     * @type {number}
     * @memberof FeatureOfCard
     */
    readonly id: number;
    /**
     * 
     * @type {Feature}
     * @memberof FeatureOfCard
     */
    readonly feature: Feature;
    /**
     * Quantity of the card in the combo.
     * @type {number}
     * @memberof FeatureOfCard
     */
    quantity: number;
    /**
     * 
     * @type {Array<string>}
     * @memberof FeatureOfCard
     */
    readonly zoneLocations: Array<string>;
    /**
     * State of the card on the battlefield, if present.
     * @type {string}
     * @memberof FeatureOfCard
     */
    battlefieldCardState: string;
    /**
     * State of the card in exile, if present.
     * @type {string}
     * @memberof FeatureOfCard
     */
    exileCardState: string;
    /**
     * State of the card in the library, if present.
     * @type {string}
     * @memberof FeatureOfCard
     */
    libraryCardState: string;
    /**
     * State of the card in the graveyard, if present.
     * @type {string}
     * @memberof FeatureOfCard
     */
    graveyardCardState: string;
    /**
     * Does the card have to be a commander?
     * @type {boolean}
     * @memberof FeatureOfCard
     */
    mustBeCommander: boolean;
}

/**
 * Check if a given object implements the FeatureOfCard interface.
 */
export function instanceOfFeatureOfCard(value: object): value is FeatureOfCard {
    if (!('id' in value) || value['id'] === undefined) return false;
    if (!('feature' in value) || value['feature'] === undefined) return false;
    if (!('quantity' in value) || value['quantity'] === undefined) return false;
    if (!('zoneLocations' in value) || value['zoneLocations'] === undefined) return false;
    if (!('battlefieldCardState' in value) || value['battlefieldCardState'] === undefined) return false;
    if (!('exileCardState' in value) || value['exileCardState'] === undefined) return false;
    if (!('libraryCardState' in value) || value['libraryCardState'] === undefined) return false;
    if (!('graveyardCardState' in value) || value['graveyardCardState'] === undefined) return false;
    if (!('mustBeCommander' in value) || value['mustBeCommander'] === undefined) return false;
    return true;
}

export function FeatureOfCardFromJSON(json: any): FeatureOfCard {
    return FeatureOfCardFromJSONTyped(json, false);
}

export function FeatureOfCardFromJSONTyped(json: any, ignoreDiscriminator: boolean): FeatureOfCard {
    if (json == null) {
        return json;
    }
    return {
        
        'id': json['id'],
        'feature': FeatureFromJSON(json['feature']),
        'quantity': json['quantity'],
        'zoneLocations': json['zoneLocations'],
        'battlefieldCardState': json['battlefieldCardState'],
        'exileCardState': json['exileCardState'],
        'libraryCardState': json['libraryCardState'],
        'graveyardCardState': json['graveyardCardState'],
        'mustBeCommander': json['mustBeCommander'],
    };
}

export function FeatureOfCardToJSON(json: any): FeatureOfCard {
    return FeatureOfCardToJSONTyped(json, false);
}

export function FeatureOfCardToJSONTyped(value?: Omit<FeatureOfCard, 'id'|'feature'|'zoneLocations'> | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'quantity': value['quantity'],
        'battlefieldCardState': value['battlefieldCardState'],
        'exileCardState': value['exileCardState'],
        'libraryCardState': value['libraryCardState'],
        'graveyardCardState': value['graveyardCardState'],
        'mustBeCommander': value['mustBeCommander'],
    };
}

