
    i5                        d dl Z d dlZd dlZd dlmZmZmZmZmZm	Z	m
Z
 d dlmZ d dlmZmZ ddlmZ ddlmZmZmZmZ dd	lmZmZmZmZmZmZmZmZ  G d
 de          Z  G d de           Z! G d de           Z" G d de           Z# G d de           Z$ G d de           Z% G d de           Z& G d de           Z' G d de           Z( G d de           Z) G d de           Z* G d  d!e           Z+ G d" d#e           Z, G d$ d%e           Z- G d& d'e           Z. G d( d)e           Z/ G d* d+e           Z0dS ),    N)AnyDictListOptionalSequenceSetUnion)show_unknown_key_warning)
JsonObjectJsonValidator   )SlackObjectFormationError   )MarkdownTextObjectPlainTextObject	SlackFile
TextObject)BlockElementFeedbackButtonsElementIconButtonElementImageElementInputInteractiveElementInteractiveElementRichTextElementUrlSourceElementc                   n   e Zd ZdZddhZdZ ej        e           Zd Z	e
dee         fd            Zdddd	dee         d
ee         dee         fdZ ede d          d             Zedeed f         ded          fd            Zedeeeed f                           ded          fd            ZdS )BlockzBlocks are a series of components that can be combined
    to create visually rich and compellingly interactive messages.
    https://docs.slack.dev/reference/block-kit/blocks
    block_idtype   c                 :    t          j        dt                     d S )Nz?subtype is deprecated since slackclient 2.6.0, use type instead)warningswarnDeprecationWarningselfs    Y/root/projects/butler/venv/lib/python3.11/site-packages/slack_sdk/models/blocks/blocks.py_subtype_warningzBlock._subtype_warning%   s&    M	
 	
 	
 	
 	
    returnc                     | j         S N)r   r%   s    r'   subtypezBlock.subtype+   s
    yr)   N)r   r-   r   r-   c                d    |r|                                   |r|n|| _        || _        d | _        d S r,   )r(   r   r   color)r&   r   r-   r   s       r'   __init__zBlock.__init__/   s@      	$!!### -DDg	 


r)   zblock_id cannot exceed  charactersc                 N    | j         d u pt          | j                   | j        k    S r,   )r   lenblock_id_max_lengthr%   s    r'   _validate_block_id_lengthzBlock._validate_block_id_length<   &    }$VDM(:(:d>V(VVr)   blockc                 R   |d S t          |t                    r|S d|v r|d         }|t          j        k    rt          di |S |t          j        k    rt	          di |S |t
          j        k    rt          di |S |t          j        k    rt          di |S |t          j        k    rt          di |S |t          j        k    rt          di |S |t          j        k    rt          di |S |t          j        k    rt          di |S |t          j        k    rt          di |S |t          j        k    rt          di |S |t          j        k    rt          di |S |t          j        k    rt          di |S |t          j        k    rt          di |S |t           j        k    rt!          di |S |t"          j        k    rt#          di |S |t$          j        k    rt%          di |S | j                            d| d           d S | j                            d| d           d S )Nr   z$Unknown block detected and skipped () )
isinstancer   SectionBlockr   DividerBlock
ImageBlockActionsBlockContextBlockContextActionsBlock
InputBlock	FileBlock	CallBlockHeaderBlockMarkdownBlock
VideoBlockRichTextBlock
TableBlockTaskCardBlock	PlanBlockloggerwarning)clsr7   r   s      r'   parsezBlock.parse@   s   =4u%% *	LV}<,,,'00%000\...'00%000Z_,,%.....\...'00%000\...'00%0000555.77777Z_,,%.....Y^++$--u---Y^++$--u---[---&/////]///(115111Z_,,%.....]///(115111Z_,,%.....]///(115111Y^++$--u---J&&'Ve'V'V'VWWW4
""#R%#R#R#RSSStr)   blocksc                 $      fd|pg D             S )Nc                 :    g | ]}                     |          S r:   )rO   ).0brN   s     r'   
<listcomp>z#Block.parse_all.<locals>.<listcomp>r   s#    333		!333r)   r:   )rN   rP   s   ` r'   	parse_allzBlock.parse_allp   s!    3333fl3333r)   )__name__
__module____qualname____doc__
attributesr4   logging	getLoggerrL   r(   propertyr   strr-   r0   r   r5   classmethodr	   dictrO   r   r   rV   r:   r)   r'   r   r      s        
 f%JWx((F
 
 
 #    X #!%"&   sm #	
 3-    ]M-@MMMNNW W ONW -%g. -8G3D - - - [-^ 4xtW}1E(FG 4DQXM 4 4 4 [4 4 4r)   r   c                       e Zd ZdZdZdZedee         f fd            Z	ddddddde
e         d	e
eeeef                  d
e
eeeeef                           de
eeef                  de
e         def fdZ ed          d             Z ede d          d             Z ede d          d             Z xZS )r<   section
     r*   c                 T    t                      j                            h d          S )N>   textexpandfields	accessorysuperr[   unionr&   	__class__s    r'   r[   zSectionBlock.attributes   s%    ww!''(Q(Q(QRRRr)   N)r   rg   ri   rj   rh   r   rg   ri   rj   rh   othersc                <   t                                          | j        |           t          | |           t	          j        |          | _        g }|pg D ]}t          |t                    r(|	                    t          j        |                     @t          |t                    r|	                    |           kt          |t                    r}d|v ryt          j        |          }	|	                    d          }
|
t          j        k    r |	                    t          di |	           |	                    t          di |	           | j                            d|            || _        t'          j        |          | _        || _        dS )a  A section is one of the most flexible blocks available.
        https://docs.slack.dev/reference/block-kit/blocks/section-block

        Args:
            block_id (required): A string acting as a unique identifier for a block.
                If not specified, one will be generated.
                You can use this block_id when you receive an interaction payload to identify the source of the action.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
            text (preferred): The text for the block, in the form of a text object.
                Maximum length for the text in this field is 3000 characters.
                This field is not required if a valid array of fields objects is provided instead.
            fields (required if no text is provided): Required if no text is provided.
                An array of text objects. Any text objects included with fields will be rendered
                in a compact format that allows for 2 columns of side-by-side text.
                Maximum number of items is 10. Maximum length for the text in each item is 2000 characters.
            accessory: One of the available element objects.
            expand: Whether or not this section block's text should always expand when rendered.
                If false or not provided, it may be rendered with a 'see more' option to expand and show the full text.
                For AI Assistant apps, this allows the app to post long messages without users needing
                to click 'see more' to expand the message.
        r   r   r   z'Unsupported filed detected and skipped Nr:   )rl   r0   r   r
   r   rO   rg   r;   r_   appendr   from_strra   copypopr   rL   rM   ri   r   rj   rh   )r&   r   rg   ri   rj   rh   rp   field_objectsfdtro   s              r'   r0   zSectionBlock.__init__   s   B 	di(;;; v...$T**	2 	S 	SA!S!! S$$%7%@%C%CDDDDAz** 
S$$Q''''At$$ S1IaLLEE&MM*///!(();)@)@a)@)@AAAA!(()=)=1)=)=>>>>##$Qa$Q$QRRRR#%+I66r)   z*text or fields attribute must be specifiedc                 "    | j         d up| j        S r,   )rg   ri   r%   s    r'   "_validate_text_or_fields_populatedz/SectionBlock._validate_text_or_fields_populated   s    y$33r)   zfields attribute cannot exceed z itemsc                 N    | j         d u pt          | j                   | j        k    S r,   )ri   r3   fields_max_lengthr%   s    r'   _validate_fields_lengthz$SectionBlock._validate_fields_length   s&    {d"Pc$+&6&6$:P&PPr)   text attribute cannot exceed r1   c                 X    | j         d u p!t          | j         j                   | j        k    S r,   rg   r3   text_max_lengthr%   s    r'   _validate_alt_text_lengthz&SectionBlock._validate_alt_text_length   (    yD OC	$7$74;O$OOr)   )rW   rX   rY   r   r~   r   r^   r   r_   r[   r   r	   ra   r   r   r   boolr0   r   r|   r   r   __classcell__ro   s   @r'   r<   r<   z   s       DOSCH S S S S S XS #'7;CG9=!%6 6 6 3-6 uS$
234	6
 %T:(=">?@6 E$"4566 6 6 6 6 6 6 6p ]?@@4 4 A@4 ]N5FNNNOOQ Q POQ ]O?OOOPPP P QPP P P P Pr)   r<   c                   >     e Zd ZdZdddee         def fdZ xZS )r=   dividerNr   r   rp   c                x    t                                          | j        |           t          | |           dS )aw  A content divider, like an <hr>, to split up different blocks inside of a message.
        https://docs.slack.dev/reference/block-kit/blocks/divider-block

        Args:
            block_id: A string acting as a unique identifier for a block. If not specified, one will be generated.
                You can use this block_id when you receive an interaction payload to identify the source of the action.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
        rr   N)rl   r0   r   r
   )r&   r   rp   ro   s      r'   r0   zDividerBlock.__init__   s:      	di(;;; v.....r)   )	rW   rX   rY   r   r   r_   ra   r0   r   r   s   @r'   r=   r=      si        D
 #'/ / / 3-/ 	/ / / / / / / / / /r)   r=   c                   r    e Zd ZdZedee         f fd            ZdZdZ	dZ
dddddded	ee         d
eeeeef         ef                  deeeeef                  dee         def fdZ ede d          d             Z ede	 d          d             Z ede
 d          d             Z xZS )r>   imager*   c                 T    t                      j                            h d          S )N>   titlealt_text	image_url
slack_filerk   rn   s    r'   r[   zImageBlock.attributes   s%    ww!''(X(X(XYYYr)   re     N)r   r   r   r   r   r   r   r   r   rp   c                   t                                          | j        |           t          | |           || _        || _        d}|t          |t                    rt          |          }nt          |t                    r|
                    d          t          j        k    r%t          d|
                    d                     t          |
                    d          |
                    d                    }n7t          |t                    r|}nt          dt          |                     |*|t          |t                    r|nt          d	i || _        || _        dS )
a3  A simple image block, designed to make those cat photos really pop.
        https://docs.slack.dev/reference/block-kit/blocks/image-block

        Args:
            alt_text (required): A plain-text summary of the image. This should not contain any markup.
                Maximum length for this field is 2000 characters.
            image_url: The URL of the image to be displayed.
                Maximum length for this field is 3000 characters.
            slack_file: A Slack image file object that defines the source of the image.
            title: An optional title for the image in the form of a text object that can only be of type: plain_text.
                Maximum length for the text in this field is 2000 characters.
            block_id: A string acting as a unique identifier for a block. If not specified, one will be generated.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
        rr   Nrg   r   z.Unsupported type for title in an image block: rg   emoji)rg   r   r:   )rl   r0   r   r
   r   r   r;   r_   r   ra   getr   r   r   r   )	r&   r   r   r   r   r   rp   parsed_titlero   s	           r'   r0   zImageBlock.__init__   ss   4 	di(;;; v..." %%% 	p.E:::E4(( p99V$$(<<<34xejenenouevev4x4xyyy.EIIf4E4EUYYW^M_M_```E?33 p$/0naefkalal0n0nooo!(0Jz94U4U0

[d[r[rgq[r[r O "


r)   z"image_url attribute cannot exceed r1   c                 N    | j         d u pt          | j                   | j        k    S r,   )r   r3   image_url_max_lengthr%   s    r'   _validate_image_url_lengthz%ImageBlock._validate_image_url_length  s&    ~%YT^)<)<@Y)YYr)   z!alt_text attribute cannot exceed c                 <    t          | j                  | j        k    S r,   )r3   r   alt_text_max_lengthr%   s    r'   r   z$ImageBlock._validate_alt_text_length  s    4=!!T%===r)   title attribute cannot exceed c                 t    | j         d u p/| j         j        d u p!t          | j         j                  | j        k    S r,   )r   rg   r3   title_max_lengthr%   s    r'   _validate_title_lengthz!ImageBlock._validate_title_length#  7    zT!mTZ_%<mDJO@T@TX\Xm@mmr)   )rW   rX   rY   r   r^   r   r_   r[   r   r   r   r   r	   r   r   r   ra   r   r0   r   r   r   r   r   r   s   @r'   r>   r>      s       DZCH Z Z Z Z Z XZ   $(AE=A"&/" /" /" /" C=	/"
 U4S>9#<=>/" c489:/" 3-/" /" /" /" /" /" /"b ]Y8LYYYZZZ Z [ZZ ]W7JWWWXX> > YX> ]Q4DQQQRRn n SRn n n n nr)   r>   c                        e Zd ZdZdZedee         f fd            Zddde	e
eef                  dee         d	ef fd
Z ede d          d             Z xZS )r?   actions   r*   c                 R    t                      j                            dh          S Nelementsrk   rn   s    r'   r[   zActionsBlock.attributes,       ww!''555r)   Nr   r   r   rp   c                    t                                          | j        |           t          | |           t	          j        |          | _        dS )a9  A block that is used to hold interactive elements.
        https://docs.slack.dev/reference/block-kit/blocks/actions-block

        Args:
            elements (required): An array of interactive element objects - buttons, select menus, overflow menus,
                or date pickers. There is a maximum of 25 elements in each action block.
            block_id: A string acting as a unique identifier for a block.
                If not specified, a block_id will be generated.
                You can use this block_id when you receive an interaction payload to identify the source of the action.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
        rr   Nrl   r0   r   r
   r   rV   r   r&   r   r   rp   ro   s       r'   r0   zActionsBlock.__init__0  sJ    ( 	di(;;; v...$.x88r)   !elements attribute cannot exceed 	 elementsc                 N    | j         d u pt          | j                   | j        k    S r,   r   r3   elements_max_lengthr%   s    r'   _validate_elements_lengthz&ActionsBlock._validate_elements_lengthI  r6   r)   )rW   rX   rY   r   r   r^   r   r_   r[   r   r	   ra   r   r   r0   r   r   r   r   s   @r'   r?   r?   (  s        D6CH 6 6 6 6 6 X6 #'	9 9 9 5'9!9:;9 3-	9
 9 9 9 9 9 92 ]U7JUUUVVW W WVW W W W Wr)   r?   c                        e Zd ZdZdZedee         f fd            Zddde	e
eeef                  dee         d	ef fd
Z ede d          d             Z xZS )r@   contextrd   r*   c                 R    t                      j                            dh          S r   rk   rn   s    r'   r[   zContextBlock.attributesR  r   r)   Nr   r   r   rp   c                    t                                          | j        |           t          | |           t	          j        |          | _        dS )a[  Displays message context, which can include both images and text.
        https://docs.slack.dev/reference/block-kit/blocks/context-block

        Args:
            elements (required): An array of image elements and text objects. Maximum number of items is 10.
            block_id: A string acting as a unique identifier for a block. If not specified, one will be generated.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
        rr   Nr   r   s       r'   r0   zContextBlock.__init__V  J    " 	di(;;; v...$.x88r)   r   r   c                 N    | j         d u pt          | j                   | j        k    S r,   r   r%   s    r'   r   z&ContextBlock._validate_elements_lengthl  r6   r)   )rW   rX   rY   r   r   r^   r   r_   r[   r   r	   ra   r   r   r   r0   r   r   r   r   s   @r'   r@   r@   N  s        D6CH 6 6 6 6 6 X6 #'	9 9 9 5|Z!?@A9 3-	9
 9 9 9 9 9 9, ]U7JUUUVVW W WVW W W W Wr)   r@   c                        e Zd ZdZdZedee         f fd            Zddde	e
eeef                  dee         d	ef fd
Z ed          d             Z ede d          d             Z xZS )rA   context_actions   r*   c                 R    t                      j                            dh          S r   rk   rn   s    r'   r[   zContextActionsBlock.attributesu  r   r)   Nr   r   r   rp   c                    t                                          | j        |           t          | |           t	          j        |          | _        dS )a  Displays actions as contextual info, which can include both feedback buttons and icon buttons.
        https://docs.slack.dev/reference/block-kit/blocks/context-actions-block

        Args:
            elements (required): An array of feedback_buttons or icon_button block elements. Maximum number of items is 5.
            block_id: A string acting as a unique identifier for a block. If not specified, one will be generated.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
        rr   Nr   r   s       r'   r0   zContextActionsBlock.__init__y  r   r)   z$elements attribute must be specifiedc                 D    | j         d u pt          | j                   dk    S Nr   )r   r3   r%   s    r'   _validate_elementsz&ContextActionsBlock._validate_elements  s#    }$>DM(:(:Q(>>r)   r   r   c                 N    | j         d u pt          | j                   | j        k    S r,   r   r%   s    r'   r   z-ContextActionsBlock._validate_elements_length  r6   r)   )rW   rX   rY   r   r   r^   r   r_   r[   r   r	   ra   r   r   r   r0   r   r   r   r   r   s   @r'   rA   rA   q  s!       D6CH 6 6 6 6 6 X6 #'	9 9 9 5'=?P!PQR9 3-	9
 9 9 9 9 9 9, ]9::? ? ;:? ]U7JUUUVVW W WVW W W W Wr)   rA   c                   n    e Zd ZdZdZdZedee         f fd            Z	dddddde
eeef         de
eeef         d	ee         d
ee
eeef                  dee         dee         def fdZ ede d          d             Z ede d          d             Z ed          d             Z xZS )rB   inputr   r*   c                 T    t                      j                            h d          S )N>   hintlabelelementoptionaldispatch_actionrk   rn   s    r'   r[   zInputBlock.attributes  s%    ww!''(c(c(cdddr)   N)r   r   r   r   r   r   r   r   r   r   rp   c                Z   t                                          | j        |           t          | |           t	          j        |t          j                  | _        t          j        |          | _	        t	          j        |t          j                  | _
        || _        || _        dS )a3  A block that collects information from users - it can hold a plain-text input element,
        a select menu element, a multi-select menu element, or a datepicker.
        https://docs.slack.dev/reference/block-kit/blocks/input-block

        Args:
            label (required): A label that appears above an input element in the form of a text object
                that must have type of plain_text. Maximum length for the text in this field is 2000 characters.
            element (required): An plain-text input element, a checkbox element, a radio button element,
                a select menu element, a multi-select menu element, or a datepicker.
            block_id: A string acting as a unique identifier for a block. If not specified, one will be generated.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message or view and each iteration of a message or view.
                If a message or view is updated, use a new block_id.
            hint: An optional hint that appears below an input element in a lighter grey.
                It must be a text object with a type of plain_text.
                Maximum length for the text in this field is 2000 characters.
            dispatch_action: A boolean that indicates whether or not the use of elements in this block
                should dispatch a block_actions payload. Defaults to false.
            optional: A boolean that indicates whether the input element may be empty when a user submits the modal.
                Defaults to false.
        rr   default_typeN)rl   r0   r   r
   r   rO   r   r   r   r   r   r   r   )	r&   r   r   r   r   r   r   rp   ro   s	           r'   r0   zInputBlock.__init__  s    @ 	di(;;; v...%e/:NOOO
#)'22$T8LMMM	. r)   zlabel attribute cannot exceed r1   c                 t    | j         d u p/| j         j        d u p!t          | j         j                  | j        k    S r,   )r   rg   r3   label_max_lengthr%   s    r'   _validate_label_lengthz!InputBlock._validate_label_length  r   r)   zhint attribute cannot exceed c                 t    | j         d u p/| j         j        d u p!t          | j         j                  | j        k    S r,   )r   rg   r3   r   r%   s    r'   _validate_hint_lengthz InputBlock._validate_hint_length  s7    yD jDINd$:jc$).>Q>QUYUj>jjr)   zelement attribute must be a string, select element, multi-select element, or a datepicker. (Sub-classes of InputInteractiveElement)c                 V    | j         d u p t          | j         t          t          f          S r,   )r   r;   r_   r   r%   s    r'   _validate_element_typez!InputBlock._validate_element_type  s(     |t#_z$,F]@^'_'__r)   )rW   rX   rY   r   r   hint_max_lengthr^   r   r_   r[   r	   ra   r   r   r   r   r0   r   r   r   r   r   r   s   @r'   rB   rB     s       DOeCH e e e e e Xe #'<@*.#''! '! '! S$/0'! sD"99:	'!
 3-'! uS$789'! "$'! 4.'! '! '! '! '! '! '!R ]Q4DQQQRRn n SRn ]O?OOOPPk k QPk ]H ` ` ` ` ` ` `r)   rB   c            	       t     e Zd ZdZedee         f fd            Zddddeded	ee         d
e	f fdZ
 xZS )rC   filer*   c                 T    t                      j                            ddh          S )Nexternal_idsourcerk   rn   s    r'   r[   zFileBlock.attributes  s#    ww!''(ABBBr)   remoteN)r   r   r   r   r   rp   c                    t                                          | j        |           t          | |           || _        || _        dS )ai  Displays a remote file.
        https://docs.slack.dev/reference/block-kit/blocks/file-block

        Args:
            external_id (required): The external unique ID for this file.
            source (required): At the moment, source will always be remote for a remote file.
            block_id: A string acting as a unique identifier for a block. If not specified, one will be generated.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
        rr   N)rl   r0   r   r
   r   r   )r&   r   r   r   rp   ro   s        r'   r0   zFileBlock.__init__  sG    & 	di(;;; v...&r)   )rW   rX   rY   r   r^   r   r_   r[   r   ra   r0   r   r   s   @r'   rC   rC     s        DCCH C C C C C XC "&    	
 3-          r)   rC   c                        e Zd ZdZedee         f fd            Zdddddedee	         dee
ee
eef         f                  dee         d	ef
 fd
Z xZS )rD   callr*   c                 T    t                      j                            h d          S )N>   r   call_idapi_decoration_availablerk   rn   s    r'   r[   zCallBlock.attributes   s%    ww!''(W(W(WXXXr)   N)r   r   r   r   r   r   rp   c                    t                                          | j        |           t          | |           || _        || _        || _        dS )zcDisplays a call information
        https://docs.slack.dev/reference/block-kit/blocks#call
        rr   N)rl   r0   r   r
   r   r   r   )r&   r   r   r   r   rp   ro   s         r'   r0   zCallBlock.__init__  sN     	di(;;; v...(@%			r)   )rW   rX   rY   r   r^   r   r_   r[   r   r   r   r   ra   r0   r   r   s   @r'   rD   rD     s        DYCH Y Y Y Y Y XY 4848"&    #+4.	
 tCc3h/01 3-          r)   rD   c            	            e Zd ZdZdZedee         f fd            Zdddde	e         de	e
eeef                  d	ef fd
Z ed          d             Z ede d          d             Z xZS )rE   header   r*   c                 R    t                      j                            dh          S Nrg   rk   rn   s    r'   r[   zHeaderBlock.attributes       ww!''111r)   N)r   rg   r   rg   rp   c                    t                                          | j        |           t          | |           t	          j        |t          j                  | _        dS )a  A header is a plain-text block that displays in a larger, bold font.
        https://docs.slack.dev/reference/block-kit/blocks/header-block

        Args:
            block_id: A string acting as a unique identifier for a block. If not specified, one will be generated.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
            text (required): The text for the block, in the form of a plain_text text object.
                Maximum length for the text in this field is 150 characters.
        rr   r   N)rl   r0   r   r
   r   rO   r   rg   )r&   r   rg   rp   ro   s       r'   r0   zHeaderBlock.__init__   sR    $ 	di(;;; v...$T8LMMM			r)    text attribute must be specifiedc                     | j         d uS r,   r   r%   s    r'   _validate_textzHeaderBlock._validate_text7  s    y$$r)   r   r1   c                 X    | j         d u p!t          | j         j                   | j        k    S r,   r   r%   s    r'   r   z%HeaderBlock._validate_alt_text_length;  r   r)   )rW   rX   rY   r   r   r^   r   r_   r[   r   r	   ra   r   r0   r   r   r   r   r   s   @r'   rE   rE     s+       DO2CH 2 2 2 2 2 X2 #'7;	N N N 3-N uS$
234	N
 N N N N N N. ]566% % 76% ]O?OOOPPP P QPP P P P Pr)   rE   c                        e Zd ZdZdZedee         f fd            Zdddede	e         d	e
f fd
Z ed          d             Z ede d          d             Z xZS )rF   markdowni.  r*   c                 R    t                      j                            dh          S r   rk   rn   s    r'   r[   zMarkdownBlock.attributesD  r   r)   Nr   rg   r   rp   c                    t                                          | j        |           t          | |           || _        dS )a+  Displays formatted markdown.
        https://docs.slack.dev/reference/block-kit/blocks/markdown-block/

        Args:
            block_id: A string acting as a unique identifier for a block. If not specified, one will be generated.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
            text (required): The standard markdown-formatted text. Limit 12,000 characters max.
        rr   N)rl   r0   r   r
   rg   )r&   rg   r   rp   ro   s       r'   r0   zMarkdownBlock.__init__H  s?    " 	di(;;; v...			r)   r   c                     | j         dk    S )N r   r%   s    r'   r   zMarkdownBlock._validate_text^  s    yBr)   r   r1   c                 <    t          | j                  | j        k    S r,   )r3   rg   r   r%   s    r'   r   z'MarkdownBlock._validate_alt_text_lengthb  s    49~~!555r)   )rW   rX   rY   r   r   r^   r   r_   r[   r   ra   r0   r   r   r   r   r   s   @r'   rF   rF   @  s       DO2CH 2 2 2 2 2 X2 #'	    3-	
      , ]566  76 ]O?OOOPP6 6 QP6 6 6 6 6r)   rF   c                   8    e Zd ZdZdZdZedee         f fd            Z	ddddddddddd
de
e         d	e
e         d
e
e         de
e         de
eeeef                  de
e         de
eeeef                  de
e         de
e         de
e         def fdZ ed          d             Z ed          d             Z ed          d             Z ed          d             Z ede d          d             Z ede d          d              Z xZS )!rG   video   2   r*   c                 T    t                      j                            h d          S )N>	   r   r   	title_url	video_urlauthor_namedescriptionprovider_namethumbnail_urlprovider_icon_urlrk   rn   s    r'   r[   zVideoBlock.attributesl  s1    ww!''
 
 

 
 	
r)   N)
r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rp   c       
         n   t                                          | j        |           t          | |           || _        || _        || _        t          j        |t          j                  | _
        || _        t          j        |t          j                  | _        || _        |	| _        |
| _        dS )u  A video block is designed to embed videos in all app surfaces
        (e.g. link unfurls, messages, modals, App Home) —
        anywhere you can put blocks! To use the video block within your app,
        you must have the links.embed:write scope.
        https://docs.slack.dev/reference/block-kit/blocks/video-block

        Args:
            block_id: A string acting as a unique identifier for a block. If not specified, one will be generated.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
            alt_text (required): A tooltip for the video. Required for accessibility
            video_url (required): The URL to be embedded. Must match any existing unfurl domains within the app
                and point to a HTTPS URL.
            thumbnail_url (required): The thumbnail image URL
            title (required): Video title in plain text format. Must be less than 200 characters.
            title_url: Hyperlink for the title text. Must correspond to the non-embeddable URL for the video.
                Must go to an HTTPS URL.
            description: Description for video in plain text format.
            provider_icon_url: Icon for the video provider - ex. Youtube icon
            provider_name: The originating application or domain of the video ex. Youtube
            author_name: Author name to be displayed. Must be less than 50 characters.
        rr   r   N)rl   r0   r   r
   r   r   r   r   rO   r   r   r   r   r   r   r   )r&   r   r   r   r   r   r   r   r   r   r   rp   ro   s               r'   r0   zVideoBlock.__init__|  s    L 	di(;;; v... "*%e/:NOOO
"%+KoFZ[[[!2*&r)   z$alt_text attribute must be specifiedc                     | j         d uS r,   )r   r%   s    r'   _validate_alt_textzVideoBlock._validate_alt_text  s    }D((r)   z%video_url attribute must be specifiedc                     | j         d uS r,   )r   r%   s    r'   _validate_video_urlzVideoBlock._validate_video_url  s    ~T))r)   z)thumbnail_url attribute must be specifiedc                     | j         d uS r,   )r   r%   s    r'   _validate_thumbnail_urlz"VideoBlock._validate_thumbnail_url  s    !--r)   z!title attribute must be specifiedc                     | j         d uS r,   )r   r%   s    r'   _validate_titlezVideoBlock._validate_title  s    z%%r)   r   r1   c                 X    | j         d u p!t          | j         j                  | j        k     S r,   )r   r3   rg   r   r%   s    r'   r   z!VideoBlock._validate_title_length  s(    zT!QS%9%9D<Q%QQr)   z$author_name attribute cannot exceed c                 N    | j         d u pt          | j                   | j        k     S r,   )r   r3   author_name_max_lengthr%   s    r'   _validate_author_name_lengthz'VideoBlock._validate_author_name_length  s(    4'^3t/?+@+@4C^+^^r)   )rW   rX   rY   r   r   r  r^   r   r_   r[   r   r	   ra   r   r0   r   r  r  r  r	  r   r  r   r   s   @r'   rG   rG   g  sk       D
CH 
 
 
 
 
 X
$ #'"&#''+=A#'CG+/'+%)1' 1' 1' 3-1' 3-	1'
 C=1'  }1' c489:1' C=1' eC$>?@1' $C=1'  }1' c]1' 1' 1' 1' 1' 1' 1'f ]9::) ) ;:) ]:;;* * <;* ]>??. . @?. ]677& & 87& ]Q4DQQQRRR R SRR ]]:P]]]^^_ _ _^_ _ _ _ _r)   rG   c                        e Zd ZdZedee         f fd            Zdddee	e
ef                  dee         de
f fd	Z xZS )
rH   	rich_textr*   c                 R    t                      j                            dh          S r   rk   rn   s    r'   r[   zRichTextBlock.attributes  r   r)   Nr   r   r   rp   c                    t                                          | j        |           t          | |           t	          j        |          | _        dS )a  A block that is used to hold interactive elements.
        https://docs.slack.dev/reference/block-kit/blocks/rich-text-block

        Args:
            elements (required): An array of rich text objects -
                rich_text_section, rich_text_list, rich_text_quote, rich_text_preformatted
            block_id: A unique identifier for a block. If not specified, one will be generated.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message or view and each iteration of a message or view.
                If a message or view is updated, use a new block_id.
        rr   Nr   r   s       r'   r0   zRichTextBlock.__init__  sJ    $ 	di(;;; v...$.x88r)   )rW   rX   rY   r   r^   r   r_   r[   r   r	   ra   r   r   r0   r   r   s   @r'   rH   rH     s        D6CH 6 6 6 6 6 X6 #'	9 9 9 5!6789 3-	9
 9 9 9 9 9 9 9 9 9 9r)   rH   c            
            e Zd ZdZedee         f fd            Zddddeee	ee
f                           deeee	ee
f                                    dee         d	ef fd
Z ed          d             Z xZS )rI   tabler*   c                 T    t                      j                            ddh          S )Nrowscolumn_settingsrk   rn   s    r'   r[   zTableBlock.attributes  s$    ww!''1B(CDDDr)   N)r  r   r  r  r   rp   c                    t                                          | j        |           t          | |           || _        || _        dS )a  Displays structured information in a table.
        https://docs.slack.dev/reference/block-kit/blocks/table-block

        Args:
            rows (required): An array consisting of table rows. Maximum 100 rows.
                Each row object is an array with a max of 20 table cells.
                Table cells can have a type of raw_text or rich_text.
            column_settings: An array describing column behavior. If there are fewer items in the column_settings array
                than there are columns in the table, then the items in the the column_settings array will describe
                the same number of columns in the table as there are in the array itself.
                Any additional columns will have the default behavior. Maximum 20 items.
                See below for column settings schema.
            block_id: A unique identifier for a block. If not specified, a block_id will be generated.
                You can use this block_id when you receive an interaction payload to identify the source of the action.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
        rr   N)rl   r0   r   r
   r  r  )r&   r  r  r   rp   ro   s        r'   r0   zTableBlock.__init__  sI    4 	di(;;; v...	.r)   z rows attribute must be specifiedc                 D    | j         d uot          | j                   dk    S r   )r  r3   r%   s    r'   _validate_rowszTableBlock._validate_rows  s!    y$;TY!);;r)   )rW   rX   rY   r   r^   r   r_   r[   r   r   r   r   ra   r0   r   r  r   r   s   @r'   rI   rI     s       DECH E E E E E XE IM"&/ / / xS#X/0/ "(8DcN+C"DE	/
 3-/ / / / / / /@ ]566< < 76< < < < <r)   rI   c                       e Zd ZdZedee         f fd            Zddddddededee	e
ef                  d	ee	e
ef                  d
eee	eef                           dedee         def fdZ ed          d             Z xZS )rJ   	task_cardr*   c                 T    t                      j                            h d          S )N>   r   outputstatusdetailssourcestask_idrk   rn   s    r'   r[   zTaskCardBlock.attributes  s1    ww!''  	
 	
 		
r)   N)r  r  r   r   r!  r   r  r  r   r  r   rp   c                    t                                          | j        |           t          | |           || _        || _        || _        || _        || _        || _	        dS )a  Displays a single task, representing a single action.
        https://docs.slack.dev/reference/block-kit/blocks/task-card-block/

        Args:
            block_id: A string acting as a unique identifier for a block. If not specified, one will be generated.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
            task_id (required): ID for the task
            title (required): Title of the task in plain text
            details: Details of the task in the form of a single "rich_text" entity.
            output: Output of the task in the form of a single "rich_text" entity.
            sources: Array of URL source elements used to generate a response.
            status: The state of a task. Either "pending", "in_progress", "complete", or "error".
        rr   N)
rl   r0   r   r
   r!  r   r  r  r   r  )
r&   r!  r   r  r  r   r  r   rp   ro   s
            r'   r0   zTaskCardBlock.__init__#  sb    6 	di(;;; v...
r)   zKstatus must be an expected value (pending, in_progress, complete, or error)c                     | j         dv S )N)pendingin_progresscompleteerror)r  r%   s    r'   r  zTaskCardBlock._validate_rowsH  s    {MMMr)   )rW   rX   rY   r   r^   r   r_   r[   r   r	   rH   ra   r   r   r0   r   r  r   r   s   @r'   rJ   rJ     sD       D

CH 

 

 

 

 

 X

" 9=7;EI"&# # # # 	#
 %t 345# }d234# (5)94)?#@AB# # 3-# # # # # # #J ]`aaN N baN N N N Nr)   rJ   c            	            e Zd ZdZedee         f fd            Zddddedee	e
eef                           dee         d	ef fd
Z xZS )rK   planr*   c                 T    t                      j                            ddh          S )Nr   tasksrk   rn   s    r'   r[   zPlanBlock.attributesP  s-    ww!''
 
 	
r)   N)r+  r   r   r+  r   rp   c                    t                                          | j        |           t          | |           || _        || _        dS )ay  Displays a collection of related tasks.
        https://docs.slack.dev/reference/block-kit/blocks/plan-block/

        Args:
            block_id: A string acting as a unique identifier for a block. If not specified, one will be generated.
                Maximum length for this field is 255 characters.
                block_id should be unique for each message and each iteration of a message.
                If a message is updated, use a new block_id.
            title (required): Title of the plan in plain text
            tasks: A sequence of task card blocks. Each task represents a single action within the plan.
        rr   N)rl   r0   r   r
   r   r+  )r&   r   r+  r   rp   ro   s        r'   r0   zPlanBlock.__init__Y  sF    & 	di(;;; v...



r)   )rW   rX   rY   r   r^   r   r_   r[   r   r   r	   r   rJ   ra   r0   r   r   s   @r'   rK   rK   M  s        D
CH 
 
 
 
 
 X
 AE"&    t]':!;<=	
 3-          r)   rK   )1ru   r\   r"   typingr   r   r   r   r   r   r	   slack_sdk.modelsr
   slack_sdk.models.basic_objectsr   r   errorsr   basic_componentsr   r   r   r   block_elementsr   r   r   r   r   r   r   r   r   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   r:   r)   r'   <module>r3     sk      B B B B B B B B B B B B B B B B B B 5 5 5 5 5 5 D D D D D D D D / / / / / / X X X X X X X X X X X X	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 W4 W4 W4 W4 W4J W4 W4 W4~KP KP KP KP KP5 KP KP KP\/ / / / /5 / / /.Fn Fn Fn Fn Fn Fn Fn FnR#W #W #W #W #W5 #W #W #WL W  W  W  W  W5  W  W  WF$W $W $W $W $W% $W $W $WNA` A` A` A` A` A` A` A`H       B       6%P %P %P %P %P% %P %P %PP$6 $6 $6 $6 $6E $6 $6 $6N^_ ^_ ^_ ^_ ^_ ^_ ^_ ^_B9 9 9 9 9E 9 9 9>)< )< )< )< )< )< )< )<X7N 7N 7N 7N 7NE 7N 7N 7Nt# # # # # # # # # #r)   