import 'package:flutter/material.dart';

@immutable
class AppColors extends ThemeExtension<AppColors> {
  // 一组浅色，一组深色
  final Color bg1;
  final Color bg2;
  final Color bg3;
  final Color text1;
  final Color text2;
  final Color strokes1;
  final Color strokes2;

  const AppColors({
    required this.bg1,
    required this.bg2,
    required this.bg3,
    required this.text1,
    required this.text2,
    required this.strokes1,
    required this.strokes2,
  });

  @override
  AppColors copyWith({
    Color? bg1,
    Color? bg2,
    Color? bg3,
    Color? text1,
    Color? text2,
    Color? strokes1,
    Color? strokes2,
  }) {
    return AppColors(
      bg1: bg1 ?? this.bg1,
      bg2: bg2 ?? this.bg2,
      bg3: bg3 ?? this.bg3,
      text1: text1 ?? this.text1,
      text2: text2 ?? this.text2,
      strokes1: strokes1 ?? this.strokes1,
      strokes2: strokes2 ?? this.strokes2,
    );
  }

  @override
  AppColors lerp(ThemeExtension<AppColors>? other, double t) {
    if (other is! AppColors) return this;
    return AppColors(
      bg1: Color.lerp(bg1, other.bg1, t)!,
      bg2: Color.lerp(bg2, other.bg2, t)!,
      bg3: Color.lerp(bg3, other.bg3, t)!,
      text1: Color.lerp(text1, other.text1, t)!,
      text2: Color.lerp(text2, other.text2, t)!,
      strokes1: Color.lerp(strokes1, other.strokes1, t)!,
      strokes2: Color.lerp(strokes2, other.strokes2, t)!,
    );
  }

  /// ✨ 工厂方法：生成浅色 / 深色版本
  static const AppColors light = AppColors(
    bg1: Color(0xFFFFFFFF),
    bg2: Color(0xFFF5F6FA),
    bg3: Color(0xFFE9EBEF),
    text1: Color(0xFF000000),
    text2: Color(0xFF5F6168),
    strokes1: Color(0xFFD0D2D8),
    strokes2: Color(0xFFE9EBEF),
  );

  static const AppColors dark = AppColors(
    bg1: Color(0xFF000000),
    bg2: Color(0xFF272A33),
    bg3: Color(0xFF1C1E25),
    text1: Color(0xFFFFFFFF),
    text2: Color(0xFF646776),
    strokes1: Color(0xFF32343C),
    strokes2: Color(0xFF1C1E25),
  );
}
