export type Goods = {
    goodsId: number,
    goodsName: string,
    categoryId: number,
    price: number,
    stock: number,
    status: number,
    coverImg: string,
    goodsDetail: string,
    cellId: number
}

export type category = {
    categoryId: number,
    categoryName: string,
    sort: number
}

export interface SubmitOrderRequestData {
  /** 微信用户唯一标识 */
  openid: string;
  /** 系统用户ID */
  userid: string;
  /** 企业ID */
  corpid: string;
  /** 支付类型 wechat:微信 balance:余额 */
  paymentType: 'wechat' | 'balance';
  /** 联系电话 */
  mobile: string;
  /** 用户姓名 */
  name: string;
  /** 企业微信用户ID或汇邦云用户ID */
  qyUserid: string;
  /** 是否内部订单 0否 1汇邦云用户 2企业微信用户 */
  isInternal: number;
  /** 订单商品明细列表 */
  goodsList: Array<{
    goodsId: number
    quantity: number
    cellId: number
  }>
}

export type SubmitOrderResponseData = ApiResponseMsgData<{
  orderId: number
  totalAmount: number
  newBalance: number
  paymentInfo: WxJsApiPreCreateResponse
}>

export type ShopGoodsResponseData = ApiResponseMsgData<{ 
    goodsList: Goods[], 
    categoryList: category[] 
}>

export interface WxJsApiPreCreateResponse {
  appId: string
  timeStamp: string
  nonceStr: string
  package: string
  signType: string
  paySign: string
}

export interface GetOpenIdRequestParams {
  code: string
}
export interface QyLoginRequestParams {
  corpid: string
  code: string
  state?: string
}

export interface ShopOrderEntity {
  orderId: number
  openid: string
  totalAmount: number
  status: number
  payStatus: number
  paymentMethod: string
  payTime: string
}

export interface ShopOrderGoodsEntity {
  orderGoodsId: number
  orderId: number
  goodsId: number
  quantity: number
  price: number
  totalAmount: number
  status: number
}

export interface GetOrdersByOpenIdDTO {
  orders: ShopOrderEntity[]
  orderGoods: ShopOrderGoodsEntity[]
  goods: Goods[]
}

export interface GetBalanceResponse {
  userid: string
  corpid: string
  balance: number
}

export interface QyLoginDTO {
  userid: string
  openid: string
  isCabinetAdmin: number
}