import 'package:flutter/material.dart';

class RatingStyle {
  final Color? barrierColor;
  final BackgroundStyle backgroundStyle;
  final Color titleColor;
  final String closeImage;
  final Color summaryTextColor;
  final Color? closeImageColor;

  final String step1Title;
  final String step1Image;

  final String step2SorryTitle;
  final String step2ThankYouTitle;
  final String step2SorrySummary;
  final String step2ThankYouSummary;

  final String? step2ThankYouEmoji;
  final String? step2SorryEmoji;

  final Color editorBarBackground;
  final String inputHint;
  final String ratingFullImage;
  final String ratingEmptyImage;
  final String ratingHalfImage;

  final Color editorTextColor;
  final Color editorHintColor;

  final RattingButtonBuilder? submitButtonBuilder;
  final ButtonStyle? submitButtonStyle;

  final Duration inAppReViewDelayTime;

  const RatingStyle({
    this.barrierColor,
    required this.backgroundStyle,
    required this.step1Title,
    required this.titleColor,
    required this.step1Image,
    required this.step2SorryTitle,
    required this.step2ThankYouTitle,
    required this.step2ThankYouSummary,
    required this.step2SorrySummary,
    required this.summaryTextColor,
    required this.editorTextColor,
    required this.editorBarBackground,
    required this.inputHint,
    required this.closeImage,
    this.closeImageColor,
    required this.ratingFullImage,
    required this.ratingEmptyImage,
    required this.ratingHalfImage,
    this.submitButtonBuilder,
    this.submitButtonStyle,
    required this.editorHintColor,
    this.step2ThankYouEmoji,
    this.step2SorryEmoji,
    this.inAppReViewDelayTime = const Duration(seconds: 2)
  }) : assert(submitButtonBuilder != null || submitButtonStyle != null,
            "You must choose one of submitButton or submitButtonStyle");

  RatingStyle.light({
    this.barrierColor,
    required this.step1Title,
    required this.step1Image,
    required this.closeImage,
    required this.step2SorryTitle,
    required this.step2ThankYouTitle,
    required this.step2SorrySummary,
    required this.step2ThankYouSummary,
    required this.inputHint,
    required this.ratingFullImage,
    required this.ratingEmptyImage,
    required this.ratingHalfImage,
    required String submitText,
    required Color submitButtonColor,
    this.step2ThankYouEmoji,
    this.step2SorryEmoji,
    this.backgroundStyle = const BackgroundStyle(backgroundColor: Colors.white),
    this.titleColor = Colors.black,
    this.summaryTextColor = const Color(0xE6000000),
    this.editorBarBackground = const Color(0xFFF1F1F1),
    Color submitTextColor = Colors.white,
    this.editorHintColor = const Color(0xffbfbfbf),
    this.editorTextColor = const Color(0xe6000000),
    this.closeImageColor = Colors.black,
    this.inAppReViewDelayTime = const Duration(seconds: 2)
  })  : submitButtonBuilder = null,
        submitButtonStyle = ButtonStyle(
            buttonText: submitText,
            buttonBgColor: submitButtonColor,
            buttonTextColor: submitTextColor);

  RatingStyle.dark({
    this.barrierColor,
    required this.step1Title,
    required this.step1Image,
    required this.closeImage,
    required this.step2SorryTitle,
    required this.step2ThankYouTitle,
    required this.step2SorrySummary,
    required this.step2ThankYouSummary,
    required this.inputHint,
    required this.ratingFullImage,
    required this.ratingEmptyImage,
    required this.ratingHalfImage,
    required String submitText,
    required Color submitButtonColor,
    this.backgroundStyle = const BackgroundStyle(backgroundColor: Color(0xFF252525)),
    this.titleColor = Colors.white,
    this.summaryTextColor = Colors.white,
    this.editorBarBackground = const Color(0x1Affffff),
    Color submitTextColor = Colors.white,
    this.editorHintColor = const Color(0x66ffffff),
    this.editorTextColor = Colors.white,
    this.closeImageColor = Colors.white,
    this.step2ThankYouEmoji,
    this.step2SorryEmoji,
    this.inAppReViewDelayTime = const Duration(seconds: 2)
  })  : submitButtonBuilder = null,
        submitButtonStyle = ButtonStyle(
            buttonText: submitText,
            buttonBgColor: submitButtonColor,
            buttonTextColor: submitTextColor);
}

class BackgroundStyle {
  final Color? backgroundColor;
  final Gradient? gradient;

  const BackgroundStyle({
    this.backgroundColor,
    this.gradient,
  }) : assert(backgroundColor != null || gradient != null,
            "You must choose one of backgroundColor or gradient");
}

class ButtonStyle {
  final String buttonText;
  final Color buttonTextColor;
  final Color buttonBgColor;

  const ButtonStyle({
    required this.buttonText,
    required this.buttonTextColor,
    required this.buttonBgColor,
  });
}

class GoingStoreStyle {
  final Color backgroundColor;
  final String summary;
  final Color summaryTextColor;
  final Color? unRatedColor;
  final Color? gLowColor;

  const GoingStoreStyle(
      {this.backgroundColor = const Color(0xe3000000),
      required this.summary,
      this.summaryTextColor = const Color(0xffffffff),
      this.unRatedColor,
      this.gLowColor});

  const GoingStoreStyle.dark(this.summary,
      {this.unRatedColor,
      this.gLowColor,
      this.backgroundColor = const Color(0xCC000000),
      this.summaryTextColor = const Color(0xffffffff)});
}

class RattingButtonTapDelegate {
  final VoidCallback onTap;

  RattingButtonTapDelegate(this.onTap);
}

typedef RattingButtonBuilder = Widget Function(RattingButtonTapDelegate delegate);

class IosThankYouStyle {
  final String thankYouImage;
  final String thankYouTitle;
  final String thankYouSummary;
  final RattingButtonBuilder? buttonBuilder;
  final ButtonStyle? buttonStyle;
  final Color titleColor;
  final Color summaryTextColor;
  final BackgroundStyle backgroundStyle;
  final VoidCallback? okClick;
  final VoidCallback? closeClick;
  Color? closeImageColor;
  final String closeImage;
  Color? barrierColor;

  IosThankYouStyle({
    required this.thankYouImage,
    required this.thankYouTitle,
    required this.thankYouSummary,
    this.buttonBuilder,
    this.buttonStyle,
    required this.backgroundStyle,
    this.closeImageColor,
    required this.closeImage,
    required this.summaryTextColor,
    required this.titleColor,
    this.okClick,
    this.closeClick,
    this.barrierColor,
  }) : assert(buttonBuilder != null || buttonStyle != null,
            "You must choose one of button or buttonStyle");

  IosThankYouStyle.light({
    required this.thankYouImage,
    required this.thankYouTitle,
    required this.thankYouSummary,
    required this.closeImage,
    required String buttonText,
    this.backgroundStyle = const BackgroundStyle(backgroundColor: Colors.white),
    this.closeImageColor = Colors.black,
    this.titleColor = const Color(0xff191B32),
    this.summaryTextColor = const Color(0xff191B32),
    this.okClick,
    this.closeClick,
    Color buttonTextColor = Colors.white,
    Color buttonBgColor = const Color(0xff008B54),
    this.barrierColor = const Color(0xAF000000),
  })  : buttonBuilder = null,
        buttonStyle = ButtonStyle(
            buttonText: buttonText, buttonBgColor: buttonBgColor, buttonTextColor: buttonTextColor);
}
