import {
  BaseResult,
  GetOtherInGetStockInfoParams,
  OtherStockInParams,
  OtherStockOutParams,
} from '@models';
import {request} from './request';

const BASE_URL = '/warehousing';

type OtherStockInData =
  | {msg: '200'; list: {id: string}[]}
  | {msg: '510'; errMsg: string};

/** 其他入库获取库存信息 */
export function otherInGetStockInfo(
  data: GetOtherInGetStockInfoParams,
): Promise<OtherStockInData> {
  return request({
    method: 'GET',
    data,
    url: `${BASE_URL}/otherWarehousing`,
  }) as any;
}

/** 其他入库 */
export function otherIn(data: OtherStockInParams): BaseResult {
  return request({
    method: 'GET',
    data,
    url: `${BASE_URL}/otherWarehou`,
  });
}

/** 其他出库 */
export function otherOut(data: OtherStockOutParams): BaseResult {
  return request({
    method: 'GET',
    data,
    url: `/askGoods/otherAskGoods`,
  });
}
