/* 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 { SearchType } from './SearchType';
import {
    SearchTypeFromJSON,
    SearchTypeFromJSONTyped,
    SearchTypeToJSON,
    SearchTypeToJSONTyped,
} from './SearchType';

/**
 * 
 * @export
 * @interface Search
 */
export interface Search {
    /**
     * 
     * @type {SearchType}
     * @memberof Search
     */
    type: SearchType;
    /**
     * 
     * @type {string}
     * @memberof Search
     */
    query: string | null;
    /**
     * 
     * @type {number}
     * @memberof Search
     */
    page?: number | null;
    /**
     * 
     * @type {string}
     * @memberof Search
     */
    gameId?: string | null;
}



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

export function SearchFromJSON(json: any): Search {
    return SearchFromJSONTyped(json, false);
}

export function SearchFromJSONTyped(json: any, ignoreDiscriminator: boolean): Search {
    if (json == null) {
        return json;
    }
    return {
        
        'type': SearchTypeFromJSON(json['type']),
        'query': json['query'],
        'page': json['page'] == null ? undefined : json['page'],
        'gameId': json['game_id'] == null ? undefined : json['game_id'],
    };
}

export function SearchToJSON(json: any): Search {
    return SearchToJSONTyped(json, false);
}

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

    return {
        
        'type': SearchTypeToJSON(value['type']),
        'query': value['query'],
        'page': value['page'],
        'game_id': value['gameId'],
    };
}

