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

export interface MerchantInfo {
  id: number;
  sellerId: number;
  shopName: string;
  logo: string;
  description: string;
  phone: string;
  province: string;
  city: string;
  district: string;
  address: string;
  longitude: number;
  latitude: number;
  businessLicense: string;
  licenseNo: string;
  legalPerson: string;
  status: 'pending' | 'approved' | 'rejected' | 'frozen';
  rejectReason: string;
  deposit: number;
  rating: number;
  reviewCount: number;
  autoConfirm: boolean;
  createdAt: string;
  updatedAt: string;
}

// 获取商家详情（公开）
export function getMerchantById(id: number) {
  return get<MerchantInfo>(`/api/app/merchants/${id}`);
}

// 获取商家列表（公开，已审核通过）
export function getMerchantList(params: {
  page?: number;
  pageSize?: number;
  keyword?: string;
  city?: string;
  checkInDate?: string;
  checkOutDate?: string;
}) {
  return get('/api/app/merchants', params);
}
