import { MarkType } from '../../types/drawing'
import { CurrentUserMark, Mark } from '../../types/mark'
import { TextStrategy } from './Text'
import { SignatureStrategy } from './Signature'

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

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

export interface MarkStrategy {
  input: React.FC<MarkInputProps>
  render: React.FC<MarkRenderProps>
  encryptAndUpload?: (value: string, key?: string) => Promise<string>
  fetchAndDecrypt?: (value: string, key?: string) => Promise<string>
}

export type MarkStrategies = {
  [key in MarkType]?: MarkStrategy
}

export const MARK_TYPE_CONFIG: MarkStrategies = {
  [MarkType.TEXT]: TextStrategy,
  [MarkType.SIGNATURE]: SignatureStrategy
}
