import { request } from '@/utils/request';

export interface ApplyMerchantParams {
  shopName: string;
  phone: string;
  province?: string;
  city?: string;
  district?: string;
  address?: string;
  description?: string;
  coverImage?: string;
  storeLicense: string;
  hotelImages?: string;
  contractType: string;
  idCardFront?: string;
  idCardBack?: string;
  legalIdCardFront?: string;
  legalIdCardBack?: string;
  businessLicense?: string;
  licenseNo?: string;
  legalPerson?: string;
  accountType: string;
  accountName?: string;
  bankAccount: string;
  bankName: string;
  bankBranch?: string;
  bankLicense?: string;
  accountIdCardFront?: string;
  accountIdCardBack?: string;
}

export interface UpdateMerchantParams {
  shopName?: string;
  logo?: string;
  phone?: string;
  description?: string;
  coverImage?: string;
  province?: string;
  city?: string;
  district?: string;
  address?: string;
  storeLicense?: string;
  hotelImages?: string;
  contractType?: string;
  idCardFront?: string;
  idCardBack?: string;
  legalIdCardFront?: string;
  legalIdCardBack?: string;
  businessLicense?: string;
  licenseNo?: string;
  legalPerson?: string;
  accountType?: string;
  accountName?: string;
  bankAccount?: string;
  bankName?: string;
  bankBranch?: string;
  bankLicense?: string;
  accountIdCardFront?: string;
  accountIdCardBack?: string;
}

// 申请创建店铺（需要商家token）
export function applyMerchant(data: ApplyMerchantParams) {
  return request({
    url: '/api/merchant/merchant/apply',
    method: 'POST',
    data,
    useSellerToken: true,
  });
}

// 获取我的店铺信息（需要商家token）
export function getMyMerchant() {
  return request({
    url: '/api/merchant/merchant/mine',
    method: 'GET',
    useSellerToken: true,
  });
}

// 更新店铺信息（需要商家token）
export function updateMerchant(data: UpdateMerchantParams) {
  return request({
    url: '/api/merchant/merchant/update',
    method: 'PUT',
    data,
    useSellerToken: true,
  });
}
