import {
  Training,
  BlockInstance,
  Block,
  ExerciseInstance,
  Exercise
} from '../gql'

export interface ITraining {
  id: string
  title: string
  type: {
    id: string
    name: string
    description: string
  }
  createdAt: string
  trainingDate: string
  location: string
  registrations: string[]
  attendance: number
  ratings: IRating[]
  published: boolean
  blocks: IBlock[]
}

export type TTraining = Pick<Training, 'id'> & Partial<Omit<Training, 'id'>>
export type TBlockInstance = Pick<BlockInstance, 'id'> &
  Partial<Omit<BlockInstance, 'id'>>
export type TBlock = Pick<Block, 'id'> & Partial<Omit<Block, 'id'>>
export type TExerciseInstance = Pick<ExerciseInstance, 'id'> &
  Partial<Omit<ExerciseInstance, 'id'>>
export type TExercise = Pick<Exercise, 'id'> & Partial<Omit<Exercise, 'id'>>

export interface IBlock {
  id: string
  sequence?: number
  title?: string
  description?: string
  video?: string
  duration?: number
  repetitions?: number
  rest?: number
  format?: IFormat
  blocks?: IBlock[]
  exercises?: IExercise[]
}

export interface IFormat {
  id: string
  name: string
  description: string
}

export interface IExercise {
  id: string
  name: string
  description: string
  repetitions: number
  videos: string[]
  pictures: string[]
  targets: string[]
  baseExercise: {
    id: string
    name: string
  }
}

export interface IRating {
  value: number
}
