import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SysStoreVO, SysStoreForm, SysStoreQuery } from '@/api/store/sysStore/types';

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

export const listSysStore = (query?: SysStoreQuery): AxiosPromise<SysStoreVO[]> => {
  return request({
    url: '/system/sysStore/list',
    method: 'get',
    params: query
  });
};

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

/**
 * 新增门店信息
 * @param data
 */
export const addSysStore = (data: SysStoreForm) => {
  return request({
    url: '/system/sysStore',
    method: 'post',
    data: data
  });
};

/**
 * 修改门店信息
 * @param data
 */
export const updateSysStore = (data: SysStoreForm) => {
  return request({
    url: '/system/sysStore',
    method: 'put',
    data: data
  });
};

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

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