import {
  BlazeImage
} from ".";

export interface BlazeMargins {
  top?: number;
  leading?: number;
  bottom?: number;
  trailing?: number;
}

export interface BlazeFont {
  // This is the font's actual name and used by iOS to load the font.
  // Example: 'Agbalumo-Regular'.
  fontName?: string;

  // This is the font's file name in the app's fonts folder used by Android (without file extention).
  // Example: 'agbalumo_regular'.
  fontFileName?: string;
}

// Only in First Time Appearance props
export interface BlazeColor {
  //iOS
  colorName?: string;
  //Android
  colorFileName?: string;
}

export interface BlazeFirstTimeSlideCTAStyle {
  title?: string;
  backgroundColor?: BlazeColor;
  textColor?: BlazeColor;
  font?: BlazeFont;
  textSize?: number;
  cornerRadius?: number;
}

export interface BlazePlayerButtonStyle {
  width?: number;
  height?: number;
  color?: string;
  isVisible?: boolean;
  scaleType?: BlazeButtonScaleType;
  isVisibleForAds?: boolean;
  customImage?: BlazePlayerItemButtonImageStates;
}

export type BlazeButtonScaleType =
  | 'MATRIX'
  | 'FIT_XY'
  | 'FIT_START'
  | 'FIT_START'
  | 'FIT_CENTER'
  | 'FIT_END'
  | 'CENTER'
  | 'CENTER_CROP'
  | 'CENTER_INSIDE';

export interface BlazeFirstTimeSlideInstructionStyle {
  headerText?: BlazeFirstTimeSlideTextStyle;
  descriptionText?: BlazeFirstTimeSlideTextStyle;
}

export interface BlazeFirstTimeSlideTextStyle {
  text?: string;
  font?: BlazeFont;
  textColor?: BlazeColor;
  textSize?: number;
}

interface BlazePlayerItemButtonImageStates {
  selectedImage?: BlazeImage;
  unselectedImage?: BlazeImage;
}

export type BlazePlayerType =
  | 'Moments'
  | 'Stories'
  | 'Videos'
  ;

export type BlazeCTAActionType =
  | 'Deeplink'
  | 'Web';

export interface BlazeSeekBarStyle {
  isVisible?: boolean;
  backgroundColor?: string; //Hex,  
  progressColor?: string; //Hex,
  height?: number;
  cornerRadius?: number;
  thumbColor?: string; //Hex,
  thumbImage?: BlazeImage;
  thumbSize?: number;
  isThumbVisible?: boolean;
}

export type BlazePrimitive = string | number | boolean;

export type VisibilityCondition =
  | { type: 'always' }
  | { type: 'never' }
  | { type: 'keyExists'; key: string }
  | { type: 'keyNotExists'; key: string }
  | { type: 'keyEquals'; key: string; value: BlazePrimitive }
  | { type: 'keyNotEquals'; key: string; value: BlazePrimitive }
  | { type: 'keyIn'; key: string; values: BlazePrimitive[] }
  | { type: 'keyNotIn'; key: string; values: BlazePrimitive[] }
  | { type: 'keyGreaterThan'; key: string; threshold: number }
  | { type: 'keyLessThan'; key: string; threshold: number }
  | { type: 'keyBetween'; key: string; min: number; max: number }
  | { type: 'keyContains'; key: string; substring: string }
  | { type: 'and'; conditions: VisibilityCondition[] }
  | { type: 'or'; conditions: VisibilityCondition[] }
  | { type: 'not'; condition: VisibilityCondition };

  export interface BlazeCustomActionButtonParams {
    id: string;
    name: string;
    appMetadata?: Record<string, BlazePrimitive>;
    visibilityCondition?: VisibilityCondition;
  }

  export interface BlazeCustomActionButton {
    customParams: BlazeCustomActionButtonParams;
    style?: BlazePlayerButtonStyle;
  }