import 'package:flutter/material.dart';

import 'tokens.dart';

class FabledSwordTheme extends ThemeExtension<FabledSwordTheme> {
  const FabledSwordTheme({
    required this.accent,
    required this.obsidian,
    required this.iron,
    required this.slate,
    required this.pewter,
    required this.parchment,
    required this.vellum,
    required this.ash,
    required this.moss,
    required this.bronze,
    required this.oxblood,
    required this.warning,
    required this.error,
    required this.info,
    required this.display,
    required this.body,
    required this.mono,
  });

  final Color accent;
  final Color obsidian, iron, slate, pewter;
  final Color parchment, vellum, ash;
  final Color moss, bronze, oxblood;
  final Color warning, error, info;
  final TextStyle display, body, mono;

  static FabledSwordTheme fromTokens() => const FabledSwordTheme(
        accent: FabledSwordTokens.accent,
        obsidian: FabledSwordTokens.obsidian,
        iron: FabledSwordTokens.iron,
        slate: FabledSwordTokens.slate,
        pewter: FabledSwordTokens.pewter,
        parchment: FabledSwordTokens.parchment,
        vellum: FabledSwordTokens.vellum,
        ash: FabledSwordTokens.ash,
        moss: FabledSwordTokens.moss,
        bronze: FabledSwordTokens.bronze,
        oxblood: FabledSwordTokens.oxblood,
        warning: FabledSwordTokens.warning,
        error: FabledSwordTokens.error,
        info: FabledSwordTokens.info,
        display: TextStyle(fontFamily: FabledSwordTokens.fontDisplay),
        body: TextStyle(fontFamily: FabledSwordTokens.fontBody),
        mono: TextStyle(fontFamily: FabledSwordTokens.fontMono),
      );

  @override
  FabledSwordTheme copyWith({
    Color? accent,
  }) =>
      FabledSwordTheme(
        accent: accent ?? this.accent,
        obsidian: obsidian, iron: iron, slate: slate, pewter: pewter,
        parchment: parchment, vellum: vellum, ash: ash,
        moss: moss, bronze: bronze, oxblood: oxblood,
        warning: warning, error: error, info: info,
        display: display, body: body, mono: mono,
      );

  @override
  FabledSwordTheme lerp(ThemeExtension<FabledSwordTheme>? other, double t) => this;
}
