import type { SubscriptionResponse, Subscription } from 'requests/getSubscriptions'

import type { LexicsId, Values } from 'features/LexicsStore/types'
import type { Match as MatchBase } from 'features/Matches/hooks'

export enum Steps {
  CardSelection = 'CardSelection',
  Error = 'Error',
  SelectPackage = 'SelectPackage',
  SelectSubscription = 'SelectSubscription',
  Success = 'Success',
}

export enum SubscriptionType {
  Month = 'month',
  PayPerView = 'pay_per_view',
  Year = 'year',
}

export type Desciption = {
  lexic: LexicsId,
  values: Values,
}

export type MatchPackage = {
  currency: string,
  description: Desciption,
  id: string,
  name: string,
  nameLexic?: LexicsId | null,
  originalObject: SubscriptionResponse,
  pass: string,
  price: number,
  type: SubscriptionType,
}

export type Match = Pick<MatchBase, (
  'id'
  | 'sportType'
  | 'team1'
  | 'team2'
  | 'tournament'
  | 'calc'
  | 'hasVideo'
)>

export type MatchSubscription = Pick<Subscription, (
  'id'
  | 'lexic'
  | 'lexic2'
  | 'lexic3'
  | 'min_price'
)>
& {
  packages: Record<SubscriptionType, Array<MatchPackage>>,
}

export type MatchSubscriptions = Array<MatchSubscription>
