import 'package:flutter/material.dart';
import 'package:openim_common/openim_common.dart';

import 'app_tokens.dart';

/// 把官方 `Styles` 静态色值对齐到 v2 Token。
///
/// 官方页面继续读 `Styles.*`，公司页面读 `AppColors.*`。只改这一处映射，
/// 禁止在页面上再叠一套颜色覆盖。必须在首屏构建前调用。
void applyOfficialStylesFromTokens() {
  Styles.c_0089FF = AppColors.primary;
  Styles.c_0C1C33 = AppColors.textPrimary;
  Styles.c_8E9AB0 = AppColors.textSecondary;
  Styles.c_E8EAEF = AppColors.divider;
  Styles.c_FF381F = AppColors.danger;
  Styles.c_CCE7FE = AppColors.bubbleMine;
  Styles.c_F4F5F7 = AppColors.chatBg;
  Styles.c_F8F9FA = AppColors.pageBg;
  Styles.c_F0F2F6 = AppColors.chatBg;
  Styles.c_F2F3F5 = AppColors.searchBg;
  Styles.c_F2F8FF = AppColors.primaryActive;
  Styles.durationOverlay = AppDuration.overlay;
  Styles.durationOverlaySwitch = AppDuration.overlaySwitch;
  Styles.reduceMotion = AppMotion.reduce;
  Styles.motionOf = AppMotion.of;
  Styles.c_18E875 = AppColors.success;
  Styles.c_FFB300 = AppColors.warning;
  Styles.c_6085B1 = AppColors.avatarGray;
  Styles.c_000000 = AppColors.maskBg;
  Styles.c_000000_opacity70 = AppColors.maskBg.withOpacity(.7);

  Styles.ts_FFFFFF_20sp_medium = TextStyle(
    color: AppColors.pageBg,
    fontSize: AppFont.title,
    fontWeight: FontWeight.w500,
  );
  Styles.ts_FFFFFF_opacity70_17sp = TextStyle(
    color: AppColors.pageBg.withOpacity(.7),
    fontSize: AppFont.body,
  );
  Styles.ts_FFFFFF_opacity70_14sp = TextStyle(
    color: AppColors.pageBg.withOpacity(.7),
    fontSize: AppFont.sub,
  );

  Styles.c_0089FF_opacity10 = AppColors.primary.withOpacity(.1);
  Styles.c_0089FF_opacity20 = AppColors.primary.withOpacity(.2);
  Styles.c_0089FF_opacity50 = AppColors.primary.withOpacity(.5);
  Styles.c_FF381F_opacity10 = AppColors.danger.withOpacity(.1);
  Styles.c_8E9AB0_opacity13 = AppColors.textSecondary.withOpacity(.13);
  Styles.c_8E9AB0_opacity15 = AppColors.textSecondary.withOpacity(.15);
  Styles.c_8E9AB0_opacity16 = AppColors.textSecondary.withOpacity(.16);
  Styles.c_8E9AB0_opacity30 = AppColors.textSecondary.withOpacity(.3);
  Styles.c_8E9AB0_opacity50 = AppColors.textSecondary.withOpacity(.5);
  Styles.c_0C1C33_opacity30 = AppColors.textPrimary.withOpacity(.3);
  Styles.c_0C1C33_opacity60 = AppColors.textPrimary.withOpacity(.6);
  Styles.c_0C1C33_opacity85 = AppColors.textPrimary.withOpacity(.85);
  Styles.c_0C1C33_opacity80 = AppColors.textPrimary.withOpacity(.8);

  Styles.ts_0C1C33_17sp = TextStyle(
    color: AppColors.textPrimary,
    fontSize: AppFont.body,
  );
  Styles.ts_0C1C33_17sp_medium = TextStyle(
    color: AppColors.textPrimary,
    fontSize: AppFont.body,
    fontWeight: FontWeight.w500,
  );
  Styles.ts_0C1C33_17sp_semibold = TextStyle(
    color: AppColors.textPrimary,
    fontSize: AppFont.body,
    fontWeight: FontWeight.w600,
  );
  Styles.ts_0C1C33_20sp = TextStyle(
    color: AppColors.textPrimary,
    fontSize: AppFont.title,
  );
  Styles.ts_0C1C33_20sp_medium = TextStyle(
    color: AppColors.textPrimary,
    fontSize: AppFont.title,
    fontWeight: FontWeight.w500,
  );
  Styles.ts_0C1C33_20sp_semibold = TextStyle(
    color: AppColors.textPrimary,
    fontSize: AppFont.title,
    fontWeight: FontWeight.w600,
  );
  Styles.ts_0089FF_10sp_semibold = TextStyle(
    color: AppColors.primary,
    fontSize: AppFont.small,
    fontWeight: FontWeight.w600,
  );
  Styles.ts_0089FF_10sp = TextStyle(
    color: AppColors.primary,
    fontSize: AppFont.small,
  );
  Styles.ts_0089FF_17sp = TextStyle(
    color: AppColors.primary,
    fontSize: AppFont.body,
  );
  Styles.ts_0089FF_17sp_semibold = TextStyle(
    color: AppColors.primary,
    fontSize: AppFont.body,
    fontWeight: FontWeight.w600,
  );
  Styles.ts_0089FF_17sp_medium = TextStyle(
    color: AppColors.primary,
    fontSize: AppFont.body,
    fontWeight: FontWeight.w500,
  );
  Styles.ts_FF381F_17sp = TextStyle(
    color: AppColors.danger,
    fontSize: AppFont.body,
  );
  Styles.ts_FF381F_12sp = TextStyle(
    color: AppColors.danger,
    fontSize: AppFont.small,
  );
  Styles.ts_FF381F_10sp = TextStyle(
    color: AppColors.danger,
    fontSize: AppFont.small,
  );
  Styles.ts_FFB300_12sp = TextStyle(
    color: AppColors.warning,
    fontSize: AppFont.small,
  );
  Styles.ts_6085B1_17sp_medium = TextStyle(
    color: AppColors.avatarGray,
    fontSize: AppFont.body,
    fontWeight: FontWeight.w500,
  );
  Styles.ts_6085B1_17sp = TextStyle(
    color: AppColors.avatarGray,
    fontSize: AppFont.body,
  );
}
