/**
 * 环境配置
 * 根据 VITE_ENV 环境变量自动切换测试/生产环境
 */

type Environment = 'development' | 'production';

interface EnvConfig {
  apiBaseUrl: string;
  env: Environment;
}

const configs: Record<Environment, EnvConfig> = {
  development: {
    apiBaseUrl: 'https://cloud.texpixel.com:10443/doc_ai/v1',
    env: 'development',
  },
  production: {
    apiBaseUrl: 'https://api.texpixel.com/doc_ai/v1',
    env: 'production',
  },
};

// 从 Vite 环境变量获取当前环境，默认为 development
const currentEnv = (import.meta.env.VITE_ENV as Environment) || 'development';

export const env = configs[currentEnv] || configs.development;

// 便捷导出
export const API_BASE_URL = env.apiBaseUrl;
export const IS_DEV = env.env === 'development';
export const IS_PROD = env.env === 'production';

