import { MarkType } from './drawing'

export interface CurrentUserMark {
  id: number
  mark: Mark
  isLast: boolean
  isCompleted: boolean
  currentValue?: string
}

export interface Mark {
  id: number
  npub: string
  pdfFileHash: string
  type: MarkType
  location: MarkLocation
  fileName: string
  value?: string
}

export interface MarkLocation extends MarkRect {
  page: number
}

export interface MarkRect {
  left: number
  top: number
  width: number
  height: number
}

export interface MarkInputProps {
  value: string
  handler: (value: string) => void
  placeholder?: string
  userMark?: CurrentUserMark
}

export interface MarkRenderProps {
  value?: string
  mark: Mark
}

export interface MarkConfig {
  input: React.FC<MarkInputProps>
  render?: React.FC<MarkRenderProps>
}

export type MarkConfigs = {
  [key in MarkType]?: MarkConfig
}
