import request from "@/utils/request";
import { Account_BaseUrl } from "@/api/config";
const baseURL = Account_BaseUrl + "/admin/padProd";
const API = {
  getList(data: getListRequest) {
    return request<any>({
      url: `${baseURL}`,
      method: "get",
      params: data
    });
  },

  get(params: getRequest) {
    return request<any>({
      url: `${baseURL}/detail`,
      method: "get",
      params
    });
  },
  edit(data: editRequest) {
    return request({
      url: `${baseURL}`,
      method: "put",
      data: data,
    });
  },
  add(data: addRequest) {
    return request({
      url: `${baseURL}`,
      method: "post",
      data: data,
    });
  },
  delete(data: delteRequest) {
    return request({
      url: `${baseURL}`,
      method: "delete",
      data: data,
    });
  },
  // pad布局列表
  getLayout() {
    return request<any>({
      url: `${baseURL}/layout`,
      method: "get",
    });
  },

}
export default API;

export type delteRequest = number | string | [number | string];

/**
 * PadDetailAddDTO
 */
export interface addRequest {
  /**
   * 布局id
   */
  padLayoutId: number | null;
  /**
   * 商品分类id
   */
  productCategoryId: number | null;
  /**
   * 商品id集合
   */
  productIdList: number[] | null;
  [property: string]: any;
}
export interface getRequest {
  /**
   * tb_pad_product_category Id
   */
  id?: number;
  [property: string]: any;
}
export interface getListRequest {
  page?: string;
  /**
   * 分类id
   */
  productCategoryId?: number;
  size?: string;
  [property: string]: any;
}

/**
 * PadDetailEditDTO
 */
export interface editRequest {
  /**
   * 列表id
   */
  id: number | null;
  /**
   * 布局id
   */
  padLayoutId?: number | null;
  /**
   * 商品列表id
   */
  productIdList?: number[] | null;
  /**
   * 排序值
   */
  sort: string;
  [property: string]: any;
}