/* 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 * as runtime from '../runtime';
import type {
  PlanDay,
  PlanMonth,
  PlanWeek,
} from '../models';
import {
    PlanDayFromJSON,
    PlanDayToJSON,
    PlanMonthFromJSON,
    PlanMonthToJSON,
    PlanWeekFromJSON,
    PlanWeekToJSON,
} from '../models';

export interface GetPlanDayForDateRequest {
    date: Date;
}

export interface GetPlanMonthForDateRequest {
    date: Date;
}

export interface GetPlanWeekForDateRequest {
    date: Date;
}

export interface SavePlanForDayRequest {
    planDay: PlanDay;
}

export interface SavePlanForMonthRequest {
    planMonth: PlanMonth;
}

export interface SavePlanForWeekRequest {
    planWeek: PlanWeek;
}

/**
 * 
 */
export class PlanApi extends runtime.BaseAPI {

    /**
     */
    async getPlanDayForDateRaw(requestParameters: GetPlanDayForDateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PlanDay>> {
        if (requestParameters.date === null || requestParameters.date === undefined) {
            throw new runtime.RequiredError('date','Required parameter requestParameters.date was null or undefined when calling getPlanDayForDate.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/plan/day/entry/{date}`.replace(`{${"date"}}`, encodeURIComponent(requestParameters.date.toISOString().substring(0,10))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => PlanDayFromJSON(jsonValue));
    }

    /**
     */
    async getPlanDayForDate(requestParameters: GetPlanDayForDateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PlanDay> {
        const response = await this.getPlanDayForDateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async getPlanMonthForDateRaw(requestParameters: GetPlanMonthForDateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PlanMonth>> {
        if (requestParameters.date === null || requestParameters.date === undefined) {
            throw new runtime.RequiredError('date','Required parameter requestParameters.date was null or undefined when calling getPlanMonthForDate.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/plan/month/entry/{date}`.replace(`{${"date"}}`, encodeURIComponent(requestParameters.date.toISOString().substring(0,10))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => PlanMonthFromJSON(jsonValue));
    }

    /**
     */
    async getPlanMonthForDate(requestParameters: GetPlanMonthForDateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PlanMonth> {
        const response = await this.getPlanMonthForDateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async getPlanWeekForDateRaw(requestParameters: GetPlanWeekForDateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PlanWeek>> {
        if (requestParameters.date === null || requestParameters.date === undefined) {
            throw new runtime.RequiredError('date','Required parameter requestParameters.date was null or undefined when calling getPlanWeekForDate.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        const response = await this.request({
            path: `/plan/week/entry/{date}`.replace(`{${"date"}}`, encodeURIComponent(requestParameters.date.toISOString().substring(0,10))),
            method: 'GET',
            headers: headerParameters,
            query: queryParameters,
        }, initOverrides);

        return new runtime.JSONApiResponse(response, (jsonValue) => PlanWeekFromJSON(jsonValue));
    }

    /**
     */
    async getPlanWeekForDate(requestParameters: GetPlanWeekForDateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PlanWeek> {
        const response = await this.getPlanWeekForDateRaw(requestParameters, initOverrides);
        return await response.value();
    }

    /**
     */
    async savePlanForDayRaw(requestParameters: SavePlanForDayRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.planDay === null || requestParameters.planDay === undefined) {
            throw new runtime.RequiredError('planDay','Required parameter requestParameters.planDay was null or undefined when calling savePlanForDay.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        const response = await this.request({
            path: `/plan/day/entry/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: PlanDayToJSON(requestParameters.planDay),
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async savePlanForDay(requestParameters: SavePlanForDayRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.savePlanForDayRaw(requestParameters, initOverrides);
    }

    /**
     */
    async savePlanForMonthRaw(requestParameters: SavePlanForMonthRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.planMonth === null || requestParameters.planMonth === undefined) {
            throw new runtime.RequiredError('planMonth','Required parameter requestParameters.planMonth was null or undefined when calling savePlanForMonth.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        const response = await this.request({
            path: `/plan/month/entry/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: PlanMonthToJSON(requestParameters.planMonth),
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async savePlanForMonth(requestParameters: SavePlanForMonthRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.savePlanForMonthRaw(requestParameters, initOverrides);
    }

    /**
     */
    async savePlanForWeekRaw(requestParameters: SavePlanForWeekRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
        if (requestParameters.planWeek === null || requestParameters.planWeek === undefined) {
            throw new runtime.RequiredError('planWeek','Required parameter requestParameters.planWeek was null or undefined when calling savePlanForWeek.');
        }

        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        const response = await this.request({
            path: `/plan/week/entry/`,
            method: 'POST',
            headers: headerParameters,
            query: queryParameters,
            body: PlanWeekToJSON(requestParameters.planWeek),
        }, initOverrides);

        return new runtime.VoidApiResponse(response);
    }

    /**
     */
    async savePlanForWeek(requestParameters: SavePlanForWeekRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
        await this.savePlanForWeekRaw(requestParameters, initOverrides);
    }

}
