// API基础配置
const config = {
  // 开发环境 - 修改为本地测试地址
  development: {
    baseURL: 'http://localhost:3200/api/v1',
    timeout: 10000
  },
  // 生产环境
  production: {
    baseURL: 'https://webapi.jiebanke.com/api/v1',
    timeout: 15000
  }
}

// 获取当前环境配置
const getConfig = () => {
  const env = process.env.NODE_ENV || 'development'
  return config[env]
}

// API端点
const endpoints = {
  // 用户相关
  USER: {
    LOGIN: '/auth/login',
    REGISTER: '/auth/register',
    PROFILE: '/user/profile',
    UPDATE_PROFILE: '/user/profile',
    UPLOAD_AVATAR: '/user/avatar'
  },
  
  // 旅行计划
  TRAVEL: {
    LIST: '/travel/list',
    DETAIL: '/travel/detail',
    CREATE: '/travel/create',
    UPDATE: '/travel/update',
    DELETE: '/travel/delete',
    JOIN: '/travel/join',
    QUIT: '/travel/quit',
    LIKE: '/travel/like',
    UNLIKE: '/travel/unlike',
    COMMENT: '/travel/comment',
    COMMENTS: '/travel/comments',
    MY_PLANS: '/travel/my-plans',
    SEARCH: '/travel/search'
  },
  
  // 动物认养
  ANIMAL: {
    LIST: '/animal/list',
    DETAIL: '/animal/detail',
    ADOPT: '/animal/adopt',
    MY_ANIMALS: '/animal/my-animals',
    CATEGORIES: '/animal/categories'
  },
  
  // 送花服务
  FLOWER: {
    LIST: '/flower/list',
    DETAIL: '/flower/detail',
    ORDER: '/flower/order',
    MY_ORDERS: '/flower/my-orders',
    CATEGORIES: '/flower/categories'
  },
  
  // 订单管理
  ORDER: {
    LIST: '/order/list',
    DETAIL: '/order/detail',
    CANCEL: '/order/cancel',
    PAY: '/order/pay',
    CONFIRM: '/order/confirm'
  },
  
  // 支付相关
  PAYMENT: {
    CREATE: '/payment/create',
    QUERY: '/payment/query',
    REFUND: '/payment/refund'
  },
  
  // 系统相关
  SYSTEM: {
    CONFIG: '/system/config',
    NOTICE: '/system/notice',
    FEEDBACK: '/system/feedback'
  },

  // 搜索相关
  SEARCH: {
    GLOBAL: '/search/global',
    SUGGESTIONS: '/search/suggestions',
    TRAVEL: '/search/travel',
    ANIMAL: '/search/animal',
    FLOWER: '/search/flower',
    USER: '/search/user'
  },

  // 推广相关
  PROMOTION: {
    DATA: '/promotion/data',
    RECORDS: '/promotion/records',
    ALL_RECORDS: '/promotion/all-records',
    QRCODE: '/promotion/qrcode',
    REWARD_DETAILS: '/promotion/reward-details',
    WITHDRAW: '/promotion/withdraw',
    WITHDRAW_RECORDS: '/promotion/withdraw-records'
  },

  // 认证相关
  AUTH: {
    PHONE_LOGIN: '/auth/phone-login',
    WECHAT_LOGIN: '/auth/wechat-login',
    PASSWORD_LOGIN: '/auth/password-login',
    SEND_SMS_CODE: '/auth/send-sms-code',
    CHECK_TOKEN: '/auth/check-token',
    REFRESH_TOKEN: '/auth/refresh-token',
    BIND_PHONE: '/auth/bind-phone',
    CHANGE_PASSWORD: '/auth/change-password',
    RESET_PASSWORD: '/auth/reset-password'
  }
}

export default {
  ...getConfig(),
  endpoints
}