import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ShopBusinessHoursVO, ShopBusinessHoursForm, ShopBusinessHoursQuery } from '@/api/system/shopBusinessHours/types';

/**
 * 查询门店营业时间列表
 * @param query
 * @returns {*}
 */

export const listShopBusinessHours = (query?: ShopBusinessHoursQuery): AxiosPromise<ShopBusinessHoursVO[]> => {
  return request({
    url: '/system/shopBusinessHours/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询门店营业时间详细
 * @param id
 */
export const getShopBusinessHours = (id: string | number): AxiosPromise<ShopBusinessHoursVO> => {
  return request({
    url: '/system/shopBusinessHours/' + id,
    method: 'get'
  });
};

/**
 * 新增门店营业时间
 * @param data
 */
export const addShopBusinessHours = (data: ShopBusinessHoursForm) => {
  return request({
    url: '/system/shopBusinessHours',
    method: 'post',
    data: data
  });
};

/**
 * 修改门店营业时间
 * @param data
 */
export const updateShopBusinessHours = (data: ShopBusinessHoursForm) => {
  return request({
    url: '/system/shopBusinessHours',
    method: 'put',
    data: data
  });
};

/**
 * 删除门店营业时间
 * @param id
 */
export const delShopBusinessHours = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/shopBusinessHours/' + id,
    method: 'delete'
  });
};
