import { View } from "../../../deps.ts"import { StringIndexed } from "../helpers.ts"import { AckFn } from "../utilities.ts"
export type SlackViewAction = | ViewSubmitAction | ViewClosedAction | ViewWorkflowStepSubmitAction | ViewWorkflowStepClosedActionexport interface SlackViewMiddlewareArgs< ViewActionType extends SlackViewAction = SlackViewAction,> { payload: ViewOutput view: ViewOutput body: ViewActionType ack: ViewAckFn<ViewActionType>}
interface PlainTextElementOutput { type: "plain_text" text: string emoji: boolean}
export interface ViewSubmitAction { type: "view_submission" team: { id: string domain: string enterprise_id?: string enterprise_name?: string } | null user: { id: string name: string team_id?: string } view: ViewOutput api_app_id: string token: string is_enterprise_install?: boolean enterprise?: { id: string name: string }}
export interface ViewClosedAction { type: "view_closed" team: { id: string domain: string enterprise_id?: string enterprise_name?: string } | null user: { id: string name: string team_id?: string } view: ViewOutput api_app_id: string token: string is_cleared: boolean is_enterprise_install?: boolean enterprise?: { id: string name: string }}
export interface ViewWorkflowStepSubmitAction extends ViewSubmitAction { trigger_id: string response_urls: [] workflow_step: { workflow_step_edit_id: string workflow_id: string step_id: string }}
export interface ViewWorkflowStepClosedAction extends ViewClosedAction { workflow_step: { workflow_step_edit_id: string workflow_id: string step_id: string }}
export interface ViewOutput { id: string callback_id: string team_id: string app_id: string | null bot_id: string title: PlainTextElementOutput type: string blocks: StringIndexed close: PlainTextElementOutput | null submit: PlainTextElementOutput | null state: { values: { [blockId: string]: { [actionId: string]: any } } } hash: string private_metadata: string root_view_id: string | null previous_view_id: string | null clear_on_close: boolean notify_on_close: boolean external_id?: string}
export interface ViewUpdateResponseAction { response_action: "update" view: View}
export interface ViewPushResponseAction { response_action: "push" view: View}
export interface ViewClearResponseAction { response_action: "clear"}
export interface ViewErrorsResponseAction { response_action: "errors" errors: { [blockId: string]: string }}
export type ViewResponseAction = | ViewUpdateResponseAction | ViewPushResponseAction | ViewClearResponseAction | ViewErrorsResponseAction
type ViewAckFn<VA extends SlackViewAction = SlackViewAction> = VA extends ViewSubmitAction ? AckFn<ViewResponseAction> : AckFn<void>