/* tslint:disable */
/* eslint-disable */
/**
 * Dash API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.1
 * 
 *
 * 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 { PlanWeekItem } from './PlanWeekItem';
import {
    PlanWeekItemFromJSON,
    PlanWeekItemFromJSONTyped,
    PlanWeekItemToJSON,
} from './PlanWeekItem';

/**
 * 
 * @export
 * @interface PlanWeek
 */
export interface PlanWeek {
    /**
     * 
     * @type {Date}
     * @memberof PlanWeek
     */
    date: Date;
    /**
     * 
     * @type {Array<PlanWeekItem>}
     * @memberof PlanWeek
     */
    items?: Array<PlanWeekItem>;
}

/**
 * Check if a given object implements the PlanWeek interface.
 */
export function instanceOfPlanWeek(value: object): boolean {
    let isInstance = true;
    isInstance = isInstance && "date" in value;

    return isInstance;
}

export function PlanWeekFromJSON(json: any): PlanWeek {
    return PlanWeekFromJSONTyped(json, false);
}

export function PlanWeekFromJSONTyped(json: any, ignoreDiscriminator: boolean): PlanWeek {
    if ((json === undefined) || (json === null)) {
        return json;
    }
    return {
        
        'date': (new Date(json['date'])),
        'items': !exists(json, 'items') ? undefined : ((json['items'] as Array<any>).map(PlanWeekItemFromJSON)),
    };
}

export function PlanWeekToJSON(value?: PlanWeek | null): any {
    if (value === undefined) {
        return undefined;
    }
    if (value === null) {
        return null;
    }
    return {
        
        'date': (value.date.toISOString().substr(0,10)),
        'items': value.items === undefined ? undefined : ((value.items as Array<any>).map(PlanWeekItemToJSON)),
    };
}

