import 'package:flutter/material.dart';

import '../config/config.dart';

const String cdnHost = 'dpk2r23lv4s2l.cloudfront.net';
const String developmentHost = 'color.jccytech.cn';
const String productionHost = 'app.pcoloring.com';
const String localAVDHost = '10.0.2.2:6888';

class ApiHelper {
  static String get countryCode => WidgetsBinding.instance.window.locale.countryCode ?? 'CN';
  static String get languageCode => WidgetsBinding.instance.window.locale.languageCode;
  static bool get isCN => countryCode == 'CN';

  static String get apiHost => Config.isDebug ? developmentHost : productionHost;
  static String get resHost => Config.isDebug ? developmentHost : cdnHost;

  // static String get apiHost => Config.isDebug ? localAVDHost : productionHost;
  // static String get resHost => Config.isDebug ? localAVDHost : cdnHost;

  static String thumbUri(String id) => 'http://$resHost/res/jigstack/thumb/320/$id.jpg';
  static String imageUri(String id) => 'http://$resHost/res/jigstack/coded/org/$id.jpg';

  static String get dailyUri => 'https://$apiHost/napi/jigstack/mobi/list/daily';
  static String get latestUri => 'https://$apiHost/napi/jigstack/mobi/list/latest';
  static String get collectionUri => 'https://$apiHost/napi/jigstack/mobi/list/collection';
}
