import 'package:flutter/material.dart';

@immutable
class BatTypography extends ThemeExtension<BatTypography> {
  final TextStyle headline1;
  final TextStyle headline2;
  final TextStyle headline3;
  final TextStyle headline4;
  final TextStyle bodyCopy;
  final TextStyle subtitle;

  final TextStyle headline3Medium;
  final TextStyle headline4Medium;
  final TextStyle bodyCopyMedium;
  final TextStyle bodyCopyBold;
  final TextStyle subtitleMedium;

  const BatTypography._({
    required this.headline1,
    required this.headline2,
    required this.headline3,
    required this.headline4,
    required this.bodyCopy,
    required this.subtitle,
    required this.headline3Medium,
    required this.headline4Medium,
    required this.bodyCopyMedium,
    required this.bodyCopyBold,
    required this.subtitleMedium,
  });

  const BatTypography.regular()
      : this._(
          headline1: const TextStyle(
              fontFamily: 'TT Firs Neue',
              fontSize: 60,
              fontWeight: FontWeight.w400,
              height: 1.4),
          headline2: const TextStyle(
              fontFamily: 'TT Firs Neue',
              fontSize: 48,
              fontWeight: FontWeight.w400,
              height: 1.4),
          headline3: const TextStyle(
              fontFamily: 'TT Firs Neue',
              fontSize: 34,
              fontWeight: FontWeight.w400,
              height: 1.4),
          headline4: const TextStyle(
              fontFamily: 'TT Firs Neue',
              fontSize: 24,
              fontWeight: FontWeight.w400,
              height: 1.4),
          bodyCopy: const TextStyle(
              fontFamily: 'TT Firs Neue',
              fontSize: 16,
              fontWeight: FontWeight.w400,
              height: 1.4),
          subtitle: const TextStyle(
              fontFamily: 'TT Firs Neue',
              fontSize: 12,
              fontWeight: FontWeight.w400,
              height: 1.4),
          headline3Medium: const TextStyle(
              fontFamily: 'TT Firs Neue',
              fontSize: 34,
              fontWeight: FontWeight.w500,
              height: 1.4),
          headline4Medium: const TextStyle(
              fontFamily: 'TT Firs Neue',
              fontSize: 24,
              fontWeight: FontWeight.w500,
              height: 1.4),
          bodyCopyMedium: const TextStyle(
              fontFamily: 'TT Firs Neue',
              fontSize: 16,
              fontWeight: FontWeight.w500,
              height: 1.4),
          bodyCopyBold: const TextStyle(
              fontFamily: 'TT Firs Neue',
              fontSize: 16,
              fontWeight: FontWeight.w600,
              height: 1.4),
          subtitleMedium: const TextStyle(
              fontFamily: 'TT Firs Neue',
              fontSize: 12,
              fontWeight: FontWeight.w500,
              height: 1.4),
        );

  @override
  BatTypography copyWith({
    TextStyle? headline1,
    TextStyle? headline2,
    TextStyle? headline3,
    TextStyle? headline4,
    TextStyle? bodyCopy,
    TextStyle? subtitle,
    TextStyle? headline3Medium,
    TextStyle? headline4Medium,
    TextStyle? bodyCopyMedium,
    TextStyle? bodyCopyBold,
    TextStyle? subtitleMedium,
  }) {
    return BatTypography._(
      headline1: headline1 ?? this.headline1,
      headline2: headline2 ?? this.headline2,
      headline3: headline3 ?? this.headline3,
      headline4: headline4 ?? this.headline4,
      bodyCopy: bodyCopy ?? this.bodyCopy,
      subtitle: subtitle ?? this.subtitle,
      headline3Medium: headline3Medium ?? this.headline3Medium,
      headline4Medium: headline4Medium ?? this.headline4Medium,
      bodyCopyMedium: bodyCopyMedium ?? this.bodyCopyMedium,
      bodyCopyBold: bodyCopyBold ?? this.bodyCopyBold,
      subtitleMedium: subtitleMedium ?? this.subtitleMedium,
    );
  }

  @override
  BatTypography lerp(ThemeExtension<BatTypography>? other, double t) {
    if (other is! BatTypography) {
      return this;
    }
    return BatTypography._(
      headline1: TextStyle.lerp(headline1, other.headline1, t)!,
      headline2: TextStyle.lerp(headline2, other.headline2, t)!,
      headline3: TextStyle.lerp(headline3, other.headline3, t)!,
      headline4: TextStyle.lerp(headline4, other.headline4, t)!,
      bodyCopy: TextStyle.lerp(bodyCopy, other.bodyCopy, t)!,
      subtitle: TextStyle.lerp(subtitle, other.subtitle, t)!,
      headline3Medium:
          TextStyle.lerp(headline3Medium, other.headline3Medium, t)!,
      headline4Medium:
          TextStyle.lerp(headline4Medium, other.headline4Medium, t)!,
      bodyCopyMedium: TextStyle.lerp(bodyCopyMedium, other.bodyCopyMedium, t)!,
      bodyCopyBold: TextStyle.lerp(bodyCopyBold, other.bodyCopyBold, t)!,
      subtitleMedium: TextStyle.lerp(subtitleMedium, other.subtitleMedium, t)!,
    );
  }
}
