/* tslint:disable */
/* eslint-disable */
/**
 * RMI Backend
 * Rug Munch Intelligence — institutional-grade crypto intelligence API. 13+ chains, 96 data providers, 8 MCP tools, x402 paid tier, sovereign-first FOSS.
 *
 * The version of the OpenAPI document: 2026.06.21
 * 
 *
 * 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 { SearchHit } from './SearchHit';
import {
    SearchHitFromJSON,
    SearchHitFromJSONTyped,
    SearchHitToJSON,
    SearchHitToJSONTyped,
} from './SearchHit';

/**
 * RAG search response.
 * @export
 * @interface SearchResponse
 */
export interface SearchResponse {
    /**
     * 
     * @type {string}
     * @memberof SearchResponse
     */
    query: string;
    /**
     * 
     * @type {Array<SearchHit>}
     * @memberof SearchResponse
     */
    hits?: Array<SearchHit>;
    /**
     * 
     * @type {number}
     * @memberof SearchResponse
     */
    total?: number;
    /**
     * 
     * @type {number}
     * @memberof SearchResponse
     */
    tookMs?: number;
    /**
     * 
     * @type {string}
     * @memberof SearchResponse
     */
    collection?: string;
}

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

export function SearchResponseFromJSON(json: any): SearchResponse {
    return SearchResponseFromJSONTyped(json, false);
}

export function SearchResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): SearchResponse {
    if (json == null) {
        return json;
    }
    return {
        
        'query': json['query'],
        'hits': json['hits'] == null ? undefined : ((json['hits'] as Array<any>).map(SearchHitFromJSON)),
        'total': json['total'] == null ? undefined : json['total'],
        'tookMs': json['took_ms'] == null ? undefined : json['took_ms'],
        'collection': json['collection'] == null ? undefined : json['collection'],
    };
}

export function SearchResponseToJSON(json: any): SearchResponse {
    return SearchResponseToJSONTyped(json, false);
}

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

    return {
        
        'query': value['query'],
        'hits': value['hits'] == null ? undefined : ((value['hits'] as Array<any>).map(SearchHitToJSON)),
        'total': value['total'],
        'took_ms': value['tookMs'],
        'collection': value['collection'],
    };
}

