import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SysShopVO, SysShopForm, SysShopQuery } from '@/api/store/sysShop/types';

/**
 * 查询门店列表
 * @param query
 * @returns {*}
 */

export const listSysShop = (query?: SysShopQuery): AxiosPromise<SysShopVO[]> => {
  return request({
    url: '/system/sysShop/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询门店详细
 * @param id
 */
export const getSysShop = (id: string | number): AxiosPromise<SysShopVO> => {
  return request({
    url: '/system/sysShop/' + id,
    method: 'get'
  });
};

/**
 * 新增门店
 * @param data
 */
export const addSysShop = (data: SysShopForm) => {
  return request({
    url: '/system/sysShop',
    method: 'post',
    data: data
  });
};

/**
 * 修改门店
 * @param data
 */
export const updateSysShop = (data: SysShopForm) => {
  return request({
    url: '/system/sysShop',
    method: 'put',
    data: data
  });
};

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

// 指定服务
export const assignService = (data: SysShopForm) => {
  return request({
    url: '/system/sysShop/assignService',
    method: 'post',
    data: data
  });
};
