import { api } from "./Api";

const FOOD_API_PREFIX = '/api/food';

export const addChoice = async (locationIndex: number, foodIndex?: number, dayIndex?: number) => {
    return await api.post<any, any>(`${FOOD_API_PREFIX}/addChoice`, JSON.stringify({ locationIndex, foodIndex, dayIndex }));
}

export const removeChoices = async (locationIndex: number, dayIndex?: number) => {
    return await api.post<any, any>(`${FOOD_API_PREFIX}/removeChoices`, JSON.stringify({ locationIndex, dayIndex }));
}

export const removeChoice = async (locationIndex: number, foodIndex: number, dayIndex?: number) => {
    return await api.post<any, any>(`${FOOD_API_PREFIX}/removeChoice`, JSON.stringify({ locationIndex, foodIndex, dayIndex }));
}

export const updateNote = async (note?: string, dayIndex?: number) => {
    return await api.post<any, any>(`${FOOD_API_PREFIX}/updateNote`, JSON.stringify({ note, dayIndex }));
}

export const changeDepartureTime = async (time: string, dayIndex?: number) => {
    return await api.post<any, any>(`${FOOD_API_PREFIX}/changeDepartureTime`, JSON.stringify({ time, dayIndex }));
}

export const jdemeObed = async () => {
    return await api.post<any, any>(`${FOOD_API_PREFIX}/jdemeObed`, JSON.stringify({}));
}
