import 'package:flutter/material.dart';
import 'package:recording_tool/core/platform/app_platform_info.dart';

enum AppEnvironment { dev, staging, prod }

class EnvironmentValues {
  const EnvironmentValues({
    required this.environment,
    required this.baseUrl,
    required this.enableNetworkLog,
    this.mainRefereeScoreH5Url = '',
  });

  final AppEnvironment environment;
  final String baseUrl;
  final bool enableNetworkLog;
  final String mainRefereeScoreH5Url;
}

class AppConfig {
  AppConfig._();

  static late EnvironmentValues current;
  static AppPackageInfo? packageInfo;

  static const appName = 'SportsX裁判工作台';
  static const designSize = Size(640, 1024);

  /// 主裁判计分 H5 链接

  static void configure({
    required AppEnvironment environment,
    AppPackageInfo? packageInfo,
  }) {
    AppConfig.packageInfo = packageInfo;
    current = switch (environment) {
      AppEnvironment.dev => const EnvironmentValues(
        environment: AppEnvironment.dev,
        // baseUrl: 'http://192.168.1.104:8000',
        baseUrl: 'https://apitest.dronex.cc',
        mainRefereeScoreH5Url:
            'https://drone.apptest.sportsx.cc/#/pages/h5/score-entry',
        enableNetworkLog: true,
      ),
      AppEnvironment.staging => const EnvironmentValues(
        environment: AppEnvironment.staging,
        baseUrl: 'https://apitest.dronex.cc',
        mainRefereeScoreH5Url:
            'https://drone.apptest.sportsx.cc/#/pages/h5/score-entry',
        enableNetworkLog: true,
      ),
      AppEnvironment.prod => const EnvironmentValues(
        environment: AppEnvironment.prod,
        baseUrl: 'https://api.dronex.cc',
        mainRefereeScoreH5Url:
            'https://drone.sportsx.cc/#/pages/h5/score-entry',
        enableNetworkLog: false,
      ),
    };
  }
}
