/* tslint:disable */ /* eslint-disable */ /** * Django Recipes * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { exists, mapValues } from '../runtime'; import type { FoodInheritFieldsInner } from './FoodInheritFieldsInner'; import { FoodInheritFieldsInnerFromJSON, FoodInheritFieldsInnerFromJSONTyped, FoodInheritFieldsInnerToJSON, } from './FoodInheritFieldsInner'; import type { FoodPropertiesFoodUnit } from './FoodPropertiesFoodUnit'; import { FoodPropertiesFoodUnitFromJSON, FoodPropertiesFoodUnitFromJSONTyped, FoodPropertiesFoodUnitToJSON, } from './FoodPropertiesFoodUnit'; import type { FoodPropertiesInner } from './FoodPropertiesInner'; import { FoodPropertiesInnerFromJSON, FoodPropertiesInnerFromJSONTyped, FoodPropertiesInnerToJSON, } from './FoodPropertiesInner'; import type { FoodRecipe } from './FoodRecipe'; import { FoodRecipeFromJSON, FoodRecipeFromJSONTyped, FoodRecipeToJSON, } from './FoodRecipe'; import type { FoodSubstituteInner } from './FoodSubstituteInner'; import { FoodSubstituteInnerFromJSON, FoodSubstituteInnerFromJSONTyped, FoodSubstituteInnerToJSON, } from './FoodSubstituteInner'; import type { FoodSupermarketCategory } from './FoodSupermarketCategory'; import { FoodSupermarketCategoryFromJSON, FoodSupermarketCategoryFromJSONTyped, FoodSupermarketCategoryToJSON, } from './FoodSupermarketCategory'; /** * * @export * @interface Food */ export interface Food { /** * * @type {number} * @memberof Food */ readonly id?: number; /** * * @type {string} * @memberof Food */ name: string; /** * * @type {string} * @memberof Food */ pluralName?: string | null; /** * * @type {string} * @memberof Food */ description?: string; /** * * @type {string} * @memberof Food */ readonly shopping?: string; /** * * @type {FoodRecipe} * @memberof Food */ recipe?: FoodRecipe | null; /** * * @type {string} * @memberof Food */ url?: string | null; /** * * @type {Array} * @memberof Food */ properties?: Array | null; /** * * @type {string} * @memberof Food */ propertiesFoodAmount?: string; /** * * @type {FoodPropertiesFoodUnit} * @memberof Food */ propertiesFoodUnit?: FoodPropertiesFoodUnit | null; /** * * @type {number} * @memberof Food */ fdcId?: number | null; /** * * @type {string} * @memberof Food */ foodOnhand?: string | null; /** * * @type {FoodSupermarketCategory} * @memberof Food */ supermarketCategory?: FoodSupermarketCategory | null; /** * * @type {string} * @memberof Food */ readonly parent?: string; /** * * @type {number} * @memberof Food */ readonly numchild?: number; /** * * @type {Array} * @memberof Food */ inheritFields?: Array | null; /** * * @type {string} * @memberof Food */ readonly fullName?: string; /** * * @type {boolean} * @memberof Food */ ignoreShopping?: boolean; /** * * @type {Array} * @memberof Food */ substitute?: Array | null; /** * * @type {boolean} * @memberof Food */ substituteSiblings?: boolean; /** * * @type {boolean} * @memberof Food */ substituteChildren?: boolean; /** * * @type {string} * @memberof Food */ readonly substituteOnhand?: string; /** * * @type {Array} * @memberof Food */ childInheritFields?: Array | null; /** * * @type {string} * @memberof Food */ openDataSlug?: string | null; } /** * Check if a given object implements the Food interface. */ export function instanceOfFood(value: object): boolean { let isInstance = true; isInstance = isInstance && "name" in value; return isInstance; } export function FoodFromJSON(json: any): Food { return FoodFromJSONTyped(json, false); } export function FoodFromJSONTyped(json: any, ignoreDiscriminator: boolean): Food { if ((json === undefined) || (json === null)) { return json; } return { 'id': !exists(json, 'id') ? undefined : json['id'], 'name': json['name'], 'pluralName': !exists(json, 'plural_name') ? undefined : json['plural_name'], 'description': !exists(json, 'description') ? undefined : json['description'], 'shopping': !exists(json, 'shopping') ? undefined : json['shopping'], 'recipe': !exists(json, 'recipe') ? undefined : FoodRecipeFromJSON(json['recipe']), 'url': !exists(json, 'url') ? undefined : json['url'], 'properties': !exists(json, 'properties') ? undefined : (json['properties'] === null ? null : (json['properties'] as Array).map(FoodPropertiesInnerFromJSON)), 'propertiesFoodAmount': !exists(json, 'properties_food_amount') ? undefined : json['properties_food_amount'], 'propertiesFoodUnit': !exists(json, 'properties_food_unit') ? undefined : FoodPropertiesFoodUnitFromJSON(json['properties_food_unit']), 'fdcId': !exists(json, 'fdc_id') ? undefined : json['fdc_id'], 'foodOnhand': !exists(json, 'food_onhand') ? undefined : json['food_onhand'], 'supermarketCategory': !exists(json, 'supermarket_category') ? undefined : FoodSupermarketCategoryFromJSON(json['supermarket_category']), 'parent': !exists(json, 'parent') ? undefined : json['parent'], 'numchild': !exists(json, 'numchild') ? undefined : json['numchild'], 'inheritFields': !exists(json, 'inherit_fields') ? undefined : (json['inherit_fields'] === null ? null : (json['inherit_fields'] as Array).map(FoodInheritFieldsInnerFromJSON)), 'fullName': !exists(json, 'full_name') ? undefined : json['full_name'], 'ignoreShopping': !exists(json, 'ignore_shopping') ? undefined : json['ignore_shopping'], 'substitute': !exists(json, 'substitute') ? undefined : (json['substitute'] === null ? null : (json['substitute'] as Array).map(FoodSubstituteInnerFromJSON)), 'substituteSiblings': !exists(json, 'substitute_siblings') ? undefined : json['substitute_siblings'], 'substituteChildren': !exists(json, 'substitute_children') ? undefined : json['substitute_children'], 'substituteOnhand': !exists(json, 'substitute_onhand') ? undefined : json['substitute_onhand'], 'childInheritFields': !exists(json, 'child_inherit_fields') ? undefined : (json['child_inherit_fields'] === null ? null : (json['child_inherit_fields'] as Array).map(FoodInheritFieldsInnerFromJSON)), 'openDataSlug': !exists(json, 'open_data_slug') ? undefined : json['open_data_slug'], }; } export function FoodToJSON(value?: Food | null): any { if (value === undefined) { return undefined; } if (value === null) { return null; } return { 'name': value.name, 'plural_name': value.pluralName, 'description': value.description, 'recipe': FoodRecipeToJSON(value.recipe), 'url': value.url, 'properties': value.properties === undefined ? undefined : (value.properties === null ? null : (value.properties as Array).map(FoodPropertiesInnerToJSON)), 'properties_food_amount': value.propertiesFoodAmount, 'properties_food_unit': FoodPropertiesFoodUnitToJSON(value.propertiesFoodUnit), 'fdc_id': value.fdcId, 'food_onhand': value.foodOnhand, 'supermarket_category': FoodSupermarketCategoryToJSON(value.supermarketCategory), 'inherit_fields': value.inheritFields === undefined ? undefined : (value.inheritFields === null ? null : (value.inheritFields as Array).map(FoodInheritFieldsInnerToJSON)), 'ignore_shopping': value.ignoreShopping, 'substitute': value.substitute === undefined ? undefined : (value.substitute === null ? null : (value.substitute as Array).map(FoodSubstituteInnerToJSON)), 'substitute_siblings': value.substituteSiblings, 'substitute_children': value.substituteChildren, 'child_inherit_fields': value.childInheritFields === undefined ? undefined : (value.childInheritFields === null ? null : (value.childInheritFields as Array).map(FoodInheritFieldsInnerToJSON)), 'open_data_slug': value.openDataSlug, }; }