import {
  BlazeColor,
  BlazeCustomActionButton,
  BlazeFirstTimeSlideCTAStyle,
  BlazeFirstTimeSlideInstructionStyle as BlazeFirstTimeSlideInstructionStyle,
  BlazeFirstTimeSlideTextStyle,
  BlazeFont,
  BlazeImage,
  BlazeMargins,
  BlazePlayerButtonStyle,
} from '.';

export interface BlazeStoryPlayerStyle {
  title?: BlazeStoryPlayerTitleTextStyle;
  lastUpdate?: BlazeStoryPlayerLastUpdateTextStyle;
  buttons?: BlazeStoryPlayerButtonsStyle;
  backgroundColor?: string;
  cta?: BlazeStoryPlayerCtaStyle;
  chips?: BlazeStoryPlayerChipsStyle;
  headerGradient?: BlazeStoryPlayerHeaderGradientStyle;
  firstTimeSlide?: BlazeStoryPlayerFirstTimeSlideStyle;
  progressBar?: BlazeStoryPlayerProgressBarStyle;
}

interface BlazeStoryPlayerFirstTimeSlideStyle {
  show?: boolean;
  cta?: BlazeFirstTimeSlideCTAStyle;
  backgroundColor?: BlazeColor;
  mainTitle?: BlazeFirstTimeSlideTextStyle;
  subtitle?: BlazeFirstTimeSlideTextStyle;
  instructions?: BlazeStoryPlayerFirstTimeSlideInstructionsStyle;
}

interface BlazeStoryPlayerProgressBarStyle {
  backgroundColor?: string;
  progressColor?: string;
}

interface BlazeStoryPlayerFirstTimeSlideInstructionsStyle {
  forward?: BlazeFirstTimeSlideInstructionStyle;
  pause?: BlazeFirstTimeSlideInstructionStyle;
  backward?: BlazeFirstTimeSlideInstructionStyle;
  transition?: BlazeFirstTimeSlideInstructionStyle;
}

interface BlazeStoryPlayerButtonsStyle {
  mute?: BlazePlayerButtonStyle;
  exit?: BlazePlayerButtonStyle;
  share?: BlazePlayerButtonStyle;
  customActionButtons?: BlazeCustomActionButton[];
}

interface BlazeStoryPlayerCtaStyle {
  cornerRadius?: number;
  textSize?: number;
  font?: BlazeFont;
  isVisible?: boolean;
}


type BlazeTextCase = 'Uppercase' | 'Lowercase';

interface BlazeStoryPlayerTitleTextStyle {
  font?: BlazeFont;
  textSize?: number;
  textColor?: string;
  isVisible?: boolean;
  image?: BlazeStoryPlayerTitleImageStyle;
}

export interface BlazeStoryPlayerTitleImageStyle {
  isVisible?: boolean;
  size?: number;
  source?: BlazeStoryPlayerTitleImageSource;
}

export type BlazeStoryPlayerTitleImageSource =
  | BlazeStoryPlayerTitleImageStaticImageSource
  | BlazeStoryPlayerTitleImageDynamicSource;

interface BlazeStoryPlayerTitleImageStaticImageSource {
  type: 'static';
  staticSource: BlazeStoryPlayerTitleImageStaticSource;
}

interface BlazeStoryPlayerTitleImageDynamicSource {
  type: 'dynamic';
  fallback?: BlazeStoryPlayerTitleImageStaticSource;
}

export type BlazeStoryPlayerTitleImageStaticSource =
  | { type: 'image'; image: BlazeImage }
  | { type: 'url'; url: string };

interface BlazeStoryPlayerLastUpdateTextStyle {
  font?: BlazeFont;
  textColor?: string;
  textSize?: number;
  textCase?: BlazeTextCase;
  isVisible?: boolean;
}

interface BlazeStoryPlayerHeaderGradientStyle {
  isVisible?: boolean;
  startColor?: string;
  endColor?: string;
}

interface BlazeStoryPlayerChipStyle {
  titlePadding?: BlazeMargins;
  text?: string;
  textColor?: string;
  backgroundColor?: string;
  isVisible?: boolean;

}

interface BlazeStoryPlayerChipsStyle {
  live?: BlazeStoryPlayerChipStyle;
  ad?: BlazeStoryPlayerChipStyle;
}
