import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PtMealTypeVO, PtMealTypeForm, PtMealTypeQuery } from '@/api/basics/basicParameter/ptMealtype/types';

/**
 * 查询营业时段列表
 * @param query
 * @returns {*}
 */
export const listPtMealtype = (query?: PtMealTypeQuery): AxiosPromise<PtMealTypeVO[]> => {
  return request({
    url: '/backstage/basicParameter/ptMealtype/list',
    method: 'get',
    params: query
  });
};

export const getAllPtMealType = (query?: PtMealTypeVO): AxiosPromise<PtMealTypeVO[]> => {
  return request({
    url: '/backstage/basicParameter/ptMealtype/getAll',
    method: 'get',
    params: query
  });
};

/**
 * 查询营业时段详细
 * @param mealId
 */
export const getPtMealtype = (mealId: string | number): AxiosPromise<PtMealTypeVO> => {
  return request({
    url: '/backstage/basicParameter/ptMealtype/' + mealId,
    method: 'get'
  });
};

/**
 * 新增营业时段
 * @param data
 */
export const addPtMealtype = (data: PtMealTypeForm) => {
  return request({
    url: '/backstage/basicParameter/ptMealtype',
    method: 'post',
    data: data
  });
};

/**
 * 修改营业时段
 * @param data
 */
export const updatePtMealtype = (data: PtMealTypeForm) => {
  return request({
    url: '/backstage/basicParameter/ptMealtype',
    method: 'put',
    data: data
  });
};

/**
 * 删除营业时段
 * @param mealId
 */
export const delPtMealtype = (mealId: string | number | Array<string | number>) => {
  return request({
    url: '/backstage/basicParameter/ptMealtype/' + mealId,
    method: 'delete'
  });
};
