export type PopupTypes = 'none' | 'create-form' | 'copy-form' | 'edit-form' | 'delete-form' | 'delete-submission' | 'info' | 'export-progress' | 'embed-form'

export interface NonePopup {
  type: 'none',
  alias: string
}

interface CreateFormPopup {
  type: 'create-form',
  alias: string
}

interface CopyFormPopup {
  type: 'copy-form'
  uid: string
  title: string
  description: string
  onSuccess: ( form: any ) => void
}

interface EditFormPopup {
  type: 'edit-form'
  uid: string
  title: string
  description: string
  onSuccess: ( uid: string, title: string, description: string ) => void
}

interface DeleteFormPopup {
  type: 'delete-form'
  uid: string
  onSuccess: (uid: string ) => void
}

interface DeleteSubmissionPopup {
  type: 'delete-submission'
  uid: string
  onSuccess: (uid: string ) => void
}

interface InfoPopup {
  type: 'info'
  legal: string
}

interface EmbedFormPopup {
  type: 'embed-form'
  uid: string
  published: boolean
}

interface ExportProgressPopup {
  type: 'export-progress'
  alias: string
  status: string
  progress: number|null
}

export type AnyPopup =
    | NonePopup
    | InfoPopup
    | CopyFormPopup
    | EditFormPopup
    | CreateFormPopup
    | DeleteFormPopup
    | DeleteSubmissionPopup
    | ExportProgressPopup
    | EmbedFormPopup

export type Popups = {
  none: NonePopup
  "info": InfoPopup,
  "copy-form": CopyFormPopup,
  "edit-form": EditFormPopup,
  "create-form": CreateFormPopup,
  "delete-form": DeleteFormPopup,
  "delete-submission": DeleteSubmissionPopup,
  "export-progress": ExportProgressPopup,
  "embed-form": EmbedFormPopup,
}
