import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StoreVO, StoreForm, StoreQuery } from '@/api/system/physical/store/types';

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

export const listStore = (query?: StoreQuery): AxiosPromise<StoreVO[]> => {
  return request({
    url: '/physical/store/list',
    method: 'get',
    params: query
  });
};

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

/**
 * 新增门店信息
 * @param data
 */
export const addStore = (data: StoreForm) => {
  return request({
    url: '/physical/store',
    method: 'post',
    data: data
  });
};

/**
 * 修改门店信息
 * @param data
 */
export const updateStore = (data: StoreForm) => {
  return request({
    url: '/physical/store',
    method: 'put',
    data: data
  });
};

/**
 * 删除门店信息
 * @param id
 */
export const delStore = (id: string | number | Array<string | number>) => {
  return request({
    url: '/physical/store/' + id,
    method: 'delete'
  });
};
export const selectPhysicalStoreSelList = (): AxiosPromise<StoreVO> => {
  return request({
    url: '/physical/store/selectPhysicalStoreSelList',
    method: 'get'
  });
};
