/* tslint:disable */
/* eslint-disable */
/**
 * Tribufu API
 * API to access Tribufu services.
 *
 * The version of the OpenAPI document: 1.3.0
 * Contact: contact@tribufu.com
 *
 * 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 { ApplicationType } from './ApplicationType';
import {
    ApplicationTypeFromJSON,
    ApplicationTypeFromJSONTyped,
    ApplicationTypeToJSON,
    ApplicationTypeToJSONTyped,
} from './ApplicationType';

/**
 * 
 * @export
 * @interface Game
 */
export interface Game {
    /**
     * 
     * @type {string}
     * @memberof Game
     */
    id?: string;
    /**
     * 
     * @type {string}
     * @memberof Game
     */
    name: string | null;
    /**
     * 
     * @type {string}
     * @memberof Game
     */
    description?: string | null;
    /**
     * 
     * @type {ApplicationType}
     * @memberof Game
     */
    type?: ApplicationType;
    /**
     * 
     * @type {string}
     * @memberof Game
     */
    organizationId?: string | null;
    /**
     * 
     * @type {string}
     * @memberof Game
     */
    iconUrl?: string | null;
    /**
     * 
     * @type {string}
     * @memberof Game
     */
    bannerUrl?: string | null;
    /**
     * 
     * @type {string}
     * @memberof Game
     */
    capsuleImageUrl?: string | null;
    /**
     * 
     * @type {string}
     * @memberof Game
     */
    libraryImageUrl?: string | null;
    /**
     * 
     * @type {string}
     * @memberof Game
     */
    slug?: string | null;
    /**
     * 
     * @type {Date}
     * @memberof Game
     */
    created?: Date;
    /**
     * 
     * @type {Date}
     * @memberof Game
     */
    updated?: Date | null;
    /**
     * 
     * @type {boolean}
     * @memberof Game
     */
    enableServers?: boolean;
    /**
     * 
     * @type {number}
     * @memberof Game
     */
    gamePort?: number | null;
    /**
     * 
     * @type {number}
     * @memberof Game
     */
    queryPort?: number | null;
    /**
     * 
     * @type {number}
     * @memberof Game
     */
    rconPort?: number | null;
    /**
     * 
     * @type {string}
     * @memberof Game
     */
    gamedigId?: string | null;
    /**
     * 
     * @type {number}
     * @memberof Game
     */
    steamAppId?: number | null;
    /**
     * 
     * @type {number}
     * @memberof Game
     */
    steamServerAppId?: number | null;
}



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

export function GameFromJSON(json: any): Game {
    return GameFromJSONTyped(json, false);
}

export function GameFromJSONTyped(json: any, ignoreDiscriminator: boolean): Game {
    if (json == null) {
        return json;
    }
    return {
        
        'id': json['id'] == null ? undefined : json['id'],
        'name': json['name'],
        'description': json['description'] == null ? undefined : json['description'],
        'type': json['type'] == null ? undefined : ApplicationTypeFromJSON(json['type']),
        'organizationId': json['organization_id'] == null ? undefined : json['organization_id'],
        'iconUrl': json['icon_url'] == null ? undefined : json['icon_url'],
        'bannerUrl': json['banner_url'] == null ? undefined : json['banner_url'],
        'capsuleImageUrl': json['capsule_image_url'] == null ? undefined : json['capsule_image_url'],
        'libraryImageUrl': json['library_image_url'] == null ? undefined : json['library_image_url'],
        'slug': json['slug'] == null ? undefined : json['slug'],
        'created': json['created'] == null ? undefined : (new Date(json['created'])),
        'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
        'enableServers': json['enable_servers'] == null ? undefined : json['enable_servers'],
        'gamePort': json['game_port'] == null ? undefined : json['game_port'],
        'queryPort': json['query_port'] == null ? undefined : json['query_port'],
        'rconPort': json['rcon_port'] == null ? undefined : json['rcon_port'],
        'gamedigId': json['gamedig_id'] == null ? undefined : json['gamedig_id'],
        'steamAppId': json['steam_app_id'] == null ? undefined : json['steam_app_id'],
        'steamServerAppId': json['steam_server_app_id'] == null ? undefined : json['steam_server_app_id'],
    };
}

export function GameToJSON(json: any): Game {
    return GameToJSONTyped(json, false);
}

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

    return {
        
        'id': value['id'],
        'name': value['name'],
        'description': value['description'],
        'type': ApplicationTypeToJSON(value['type']),
        'organization_id': value['organizationId'],
        'icon_url': value['iconUrl'],
        'banner_url': value['bannerUrl'],
        'capsule_image_url': value['capsuleImageUrl'],
        'library_image_url': value['libraryImageUrl'],
        'slug': value['slug'],
        'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
        'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
        'enable_servers': value['enableServers'],
        'game_port': value['gamePort'],
        'query_port': value['queryPort'],
        'rcon_port': value['rconPort'],
        'gamedig_id': value['gamedigId'],
        'steam_app_id': value['steamAppId'],
        'steam_server_app_id': value['steamServerAppId'],
    };
}

