1package slack
2
3// InputBlock defines data that is used to display user input fields.
4//
5// More Information: https://api.slack.com/reference/block-kit/blocks#input
6type InputBlock struct {
7	Type           MessageBlockType `json:"type"`
8	BlockID        string           `json:"block_id,omitempty"`
9	Label          *TextBlockObject `json:"label"`
10	Element        BlockElement     `json:"element"`
11	Hint           *TextBlockObject `json:"hint,omitempty"`
12	Optional       bool             `json:"optional,omitempty"`
13	DispatchAction bool             `json:"dispatch_action,omitempty"`
14}
15
16// BlockType returns the type of the block
17func (s InputBlock) BlockType() MessageBlockType {
18	return s.Type
19}
20
21// NewInputBlock returns a new instance of an input block
22func NewInputBlock(blockID string, label *TextBlockObject, element BlockElement) *InputBlock {
23	return &InputBlock{
24		Type:    MBTInput,
25		BlockID: blockID,
26		Label:   label,
27		Element: element,
28	}
29}
30