Files
recipes/vue3/src/openapi/models/MealPlan.ts
2024-03-27 08:36:55 -05:00

192 lines
4.8 KiB
TypeScript

/* tslint:disable */
/* eslint-disable */
/**
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.0
*
*
* 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 { MealType } from './MealType';
import {
MealTypeFromJSON,
MealTypeFromJSONTyped,
MealTypeToJSON,
} from './MealType';
import type { RecipeOverview } from './RecipeOverview';
import {
RecipeOverviewFromJSON,
RecipeOverviewFromJSONTyped,
RecipeOverviewToJSON,
} from './RecipeOverview';
import type { User } from './User';
import {
UserFromJSON,
UserFromJSONTyped,
UserToJSON,
} from './User';
/**
* Adds nested create feature
* @export
* @interface MealPlan
*/
export interface MealPlan {
/**
*
* @type {number}
* @memberof MealPlan
*/
readonly id: number;
/**
*
* @type {string}
* @memberof MealPlan
*/
title?: string;
/**
*
* @type {RecipeOverview}
* @memberof MealPlan
*/
recipe?: RecipeOverview | 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 {MealType}
* @memberof MealPlan
*/
mealType: MealType;
/**
*
* @type {number}
* @memberof MealPlan
*/
readonly createdBy: number;
/**
*
* @type {Array<User>}
* @memberof MealPlan
*/
shared?: Array<User> | 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 && "id" in value;
isInstance = isInstance && "servings" in value;
isInstance = isInstance && "noteMarkdown" in value;
isInstance = isInstance && "fromDate" in value;
isInstance = isInstance && "mealType" in value;
isInstance = isInstance && "createdBy" in value;
isInstance = isInstance && "recipeName" in value;
isInstance = isInstance && "mealTypeName" in value;
isInstance = isInstance && "shopping" 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': json['id'],
'title': !exists(json, 'title') ? undefined : json['title'],
'recipe': !exists(json, 'recipe') ? undefined : RecipeOverviewFromJSON(json['recipe']),
'servings': json['servings'],
'note': !exists(json, 'note') ? undefined : json['note'],
'noteMarkdown': json['note_markdown'],
'fromDate': (new Date(json['from_date'])),
'toDate': !exists(json, 'to_date') ? undefined : (new Date(json['to_date'])),
'mealType': MealTypeFromJSON(json['meal_type']),
'createdBy': json['created_by'],
'shared': !exists(json, 'shared') ? undefined : (json['shared'] === null ? null : (json['shared'] as Array<any>).map(UserFromJSON)),
'recipeName': json['recipe_name'],
'mealTypeName': json['meal_type_name'],
'shopping': json['shopping'],
};
}
export function MealPlanToJSON(value?: MealPlan | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'title': value.title,
'recipe': RecipeOverviewToJSON(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': MealTypeToJSON(value.mealType),
'shared': value.shared === undefined ? undefined : (value.shared === null ? null : (value.shared as Array<any>).map(UserToJSON)),
};
}