Files
recipes/vue3/models/MealPlan.ts
2024-02-21 20:18:54 +01:00

186 lines
5.0 KiB
TypeScript

/* 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 { CustomFilterSharedInner } from './CustomFilterSharedInner';
import {
CustomFilterSharedInnerFromJSON,
CustomFilterSharedInnerFromJSONTyped,
CustomFilterSharedInnerToJSON,
} from './CustomFilterSharedInner';
import type { MealPlanMealType } from './MealPlanMealType';
import {
MealPlanMealTypeFromJSON,
MealPlanMealTypeFromJSONTyped,
MealPlanMealTypeToJSON,
} from './MealPlanMealType';
import type { MealPlanRecipe } from './MealPlanRecipe';
import {
MealPlanRecipeFromJSON,
MealPlanRecipeFromJSONTyped,
MealPlanRecipeToJSON,
} from './MealPlanRecipe';
/**
*
* @export
* @interface MealPlan
*/
export interface MealPlan {
/**
*
* @type {number}
* @memberof MealPlan
*/
readonly id?: number;
/**
*
* @type {string}
* @memberof MealPlan
*/
title?: string;
/**
*
* @type {MealPlanRecipe}
* @memberof MealPlan
*/
recipe?: MealPlanRecipe | null;
/**
*
* @type {string}
* @memberof MealPlan
*/
servings: string;
/**
*
* @type {string}
* @memberof MealPlan
*/
note?: string;
/**
*
* @type {string}
* @memberof MealPlan
*/
readonly noteMarkdown?: string;
/**
*
* @type {Date}
* @memberof MealPlan
*/
fromDate: Date;
/**
*
* @type {Date}
* @memberof MealPlan
*/
toDate?: Date;
/**
*
* @type {MealPlanMealType}
* @memberof MealPlan
*/
mealType: MealPlanMealType;
/**
*
* @type {string}
* @memberof MealPlan
*/
readonly createdBy?: string;
/**
*
* @type {Array<CustomFilterSharedInner>}
* @memberof MealPlan
*/
shared?: Array<CustomFilterSharedInner> | null;
/**
*
* @type {string}
* @memberof MealPlan
*/
readonly recipeName?: string;
/**
*
* @type {string}
* @memberof MealPlan
*/
readonly mealTypeName?: string;
/**
*
* @type {string}
* @memberof MealPlan
*/
readonly shopping?: string;
}
/**
* Check if a given object implements the MealPlan interface.
*/
export function instanceOfMealPlan(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "servings" in value;
isInstance = isInstance && "fromDate" in value;
isInstance = isInstance && "mealType" in value;
return isInstance;
}
export function MealPlanFromJSON(json: any): MealPlan {
return MealPlanFromJSONTyped(json, false);
}
export function MealPlanFromJSONTyped(json: any, ignoreDiscriminator: boolean): MealPlan {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'title': !exists(json, 'title') ? undefined : json['title'],
'recipe': !exists(json, 'recipe') ? undefined : MealPlanRecipeFromJSON(json['recipe']),
'servings': json['servings'],
'note': !exists(json, 'note') ? undefined : json['note'],
'noteMarkdown': !exists(json, 'note_markdown') ? undefined : json['note_markdown'],
'fromDate': (new Date(json['from_date'])),
'toDate': !exists(json, 'to_date') ? undefined : (new Date(json['to_date'])),
'mealType': MealPlanMealTypeFromJSON(json['meal_type']),
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
'shared': !exists(json, 'shared') ? undefined : (json['shared'] === null ? null : (json['shared'] as Array<any>).map(CustomFilterSharedInnerFromJSON)),
'recipeName': !exists(json, 'recipe_name') ? undefined : json['recipe_name'],
'mealTypeName': !exists(json, 'meal_type_name') ? undefined : json['meal_type_name'],
'shopping': !exists(json, 'shopping') ? undefined : json['shopping'],
};
}
export function MealPlanToJSON(value?: MealPlan | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'title': value.title,
'recipe': MealPlanRecipeToJSON(value.recipe),
'servings': value.servings,
'note': value.note,
'from_date': (value.fromDate.toISOString().substring(0,10)),
'to_date': value.toDate === undefined ? undefined : (value.toDate.toISOString().substring(0,10)),
'meal_type': MealPlanMealTypeToJSON(value.mealType),
'shared': value.shared === undefined ? undefined : (value.shared === null ? null : (value.shared as Array<any>).map(CustomFilterSharedInnerToJSON)),
};
}