/* tslint:disable */
/* eslint-disable */
/**
 * CWMS Data API
 * CWMS REST API for Data Retrieval
 *
 * The version of the OpenAPI document: 2.3.2-2025.03.19
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import type { LocationCatalogEntry } from './LocationCatalogEntry';
import {
    instanceOfLocationCatalogEntry,
    LocationCatalogEntryFromJSON,
    LocationCatalogEntryFromJSONTyped,
    LocationCatalogEntryToJSON,
} from './LocationCatalogEntry';
import type { TimeSeriesCatalogEntry } from './TimeSeriesCatalogEntry';
import {
    instanceOfTimeSeriesCatalogEntry,
    TimeSeriesCatalogEntryFromJSON,
    TimeSeriesCatalogEntryFromJSONTyped,
    TimeSeriesCatalogEntryToJSON,
} from './TimeSeriesCatalogEntry';

/**
 * @type CatalogEntry
 * 
 * @export
 */
export type CatalogEntry = LocationCatalogEntry | TimeSeriesCatalogEntry;

export function CatalogEntryFromJSON(json: any): CatalogEntry {
    return CatalogEntryFromJSONTyped(json, false);
}

export function CatalogEntryFromJSONTyped(json: any, ignoreDiscriminator: boolean): CatalogEntry {
    if (json == null) {
        return json;
    }
    return { ...LocationCatalogEntryFromJSONTyped(json, true), ...TimeSeriesCatalogEntryFromJSONTyped(json, true) };
}

export function CatalogEntryToJSON(value?: CatalogEntry | null): any {
    if (value == null) {
        return value;
    }

    if (instanceOfLocationCatalogEntry(value)) {
        return LocationCatalogEntryToJSON(value as LocationCatalogEntry);
    }
    if (instanceOfTimeSeriesCatalogEntry(value)) {
        return TimeSeriesCatalogEntryToJSON(value as TimeSeriesCatalogEntry);
    }

    return {};
}

