o
    aqe7                     @   s   d dl mZmZ d dlmZmZmZmZ ddlm	Z	m
Z
mZmZ ddlmZmZmZ h dZG dd de
ed	ZG d
d deZG dd deZG dd de
ed	ZG dd deZG dd deZG dd deZG dd deZG dd deZdS )    )ABCMetaabstractmethod)ListOptionalSetUnion   )EnumValidator
JsonObjectJsonValidatorextract_json)DynamicSelectElementTypesOptionOptionGroup>   telurlemailnumberc                   @   sj  e Zd Zh dZdZdZdZdZee	dd Z
ee	dd Zd	d
d
d
dd
d
ddedededee dee dee dedee dee fddZede ddd Zede ddd Zede dd d! Zed"e dd#d$ Zed%d&d' Zed(d)d* Zed+d,d- Zed.d/d0 Zed1d2d3 Zed4d5d6 Zeded7d8 Zd
S )9DialogTextComponent>
   hintnametypelabelvaluesubtypeoptional
max_length
min_lengthplaceholder,  0      c                 C      d S N selfr$   r$   b/var/www/html/humari/django-venv/lib/python3.10/site-packages/slack/web/classes/dialog_elements.pyr         zDialogTextComponent.typec                 C   r"   r#   r$   r%   r$   r$   r'   max_value_length"   r(   z$DialogTextComponent.max_value_lengthFNr   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   c       	   
      C   s@   || _ || _|| _|| _|| _|| _|| _|p| j| _|	| _	d S r#   )
r   r   r   r   r   r   r   r)   r   r   )
r&   r   r   r   r   r   r   r   r   r   r$   r$   r'   __init__'   s   
zDialogTextComponent.__init__name attribute cannot exceed  charactersc                 C      t | j| jk S r#   lenr   name_max_lengthr%   r$   r$   r'   name_length>      zDialogTextComponent.name_lengthlabel attribute cannot exceed c                 C   r-   r#   r/   r   label_max_lengthr%   r$   r$   r'   label_lengthB   r2   z DialogTextComponent.label_length$placeholder attribute cannot exceed c                 C      | j d u pt| j | jk S r#   r   r/   placeholder_max_lengthr%   r$   r$   r'   placeholder_lengthF      
z&DialogTextComponent.placeholder_lengthzhint attribute cannot exceed c                 C   r8   r#   )r   r/   hint_max_lengthr%   r$   r$   r'   hint_lengthO      zDialogTextComponent.hint_lengthzvalue attribute exceeded boundsc                 C   r8   r#   )r   r/   r)   r%   r$   r$   r'   value_lengthS   r?   z DialogTextComponent.value_lengthz7min_length attribute must be greater than or equal to 0c                 C   s   | j d u p	| j dkS Nr   )r   r%   r$   r$   r'   min_length_above_zeroW      z)DialogTextComponent.min_length_above_zeroz"min_length attribute exceed boundsc                 C      | j d u p
| j | jkS r#   )r   r)   r%   r$   r$   r'   min_length_length[      z%DialogTextComponent.min_length_lengthz:min_length attribute must be less than max value attributec                 C   s   | j d u p
| j | jk S r#   )r   r   r%   r$   r$   r'   min_length_below_max_length_   rF   z/DialogTextComponent.min_length_below_max_lengthz7max_length attribute must be greater than or equal to 0c                 C   s   | j d u p	| j dkS rA   )r   r%   r$   r$   r'   max_length_above_zeroc   rC   z)DialogTextComponent.max_length_above_zeroz$max_length attribute exceeded boundsc                 C   rD   r#   )r   r)   r%   r$   r$   r'   max_length_lengthg   rF   z%DialogTextComponent.max_length_lengthc                 C   s   | j d u p	| j tv S r#   )r   TextElementSubtypesr%   r$   r$   r'   subtype_validk   rC   z!DialogTextComponent.subtype_valid)__name__
__module____qualname__
attributesr0   r5   r:   r=   propertyr   r   r)   strboolr   intr*   r   r1   r6   r;   r>   r@   rB   rE   rG   rH   rI   r	   rJ   rK   r$   r$   r$   r'   r   
   s|    	












r   )	metaclassc                   @      e Zd ZdZdZdZdS )DialogTextFieldzk
    Text elements are single-line plain text fields.

    https://api.slack.com/dialogs#text_elements
    textr!   NrL   rM   rN   __doc__r   r)   r$   r$   r$   r'   rV   p   s    rV   c                   @   rU   )DialogTextAreaac  
    A textarea is a multi-line plain text editing control. You've likely encountered
    these on the world wide web. Use this element if you want a relatively long
    answer from users. The element UI provides a remaining character count to the
    max_length you have set or the default, 3000.

    https://api.slack.com/dialogs#textarea_elements
    textareai  NrX   r$   r$   r$   r'   rZ   {   s    	rZ   c                       s   e Zd ZeddhZh dZdZdZdZ	e
edefdd	Zd
ddddedededeeef def
ddZede ddd Zede ddd Zede	 ddd Zededd  Zdef fd!d"Z  ZS )#AbstractDialogSelectorexternalstatic>   r   r   r   r   data_sourcer   r   r    r!   returnc                 C   r"   r#   r$   r%   r$   r$   r'   r_      r(   z"AbstractDialogSelector.data_sourceFNr   r   r   r   r   r   r   r   c                C   s(   || _ || _|| _|| _|| _d| _d S )Nselect)r   r   r   r   r   r   r&   r   r   r   r   r   r$   r$   r'   r*      s   	
zAbstractDialogSelector.__init__r+   r,   c                 C   r-   r#   r.   r%   r$   r$   r'   r1      r2   z"AbstractDialogSelector.name_lengthr3   c                 C   r-   r#   r4   r%   r$   r$   r'   r6      r2   z#AbstractDialogSelector.label_lengthr7   c                 C   r8   r#   r9   r%   r$   r$   r'   r;      r<   z)AbstractDialogSelector.placeholder_lengthr_   c                 C   s   | j | jv S r#   )r_   DataSourceTypesr%   r$   r$   r'   data_source_valid   s   z(AbstractDialogSelector.data_source_validc                    s   t   }| jdkr*t| jtrt| jgd|d< |S | jd ur(t| j|d< |S t| jtr8| jj|d< |S | jd urB| j|d< |S )Nr]   dialogselected_optionsr   )superto_dictr_   
isinstancer   r   r   from_single_valuer&   json	__class__r$   r'   ri      s   




zAbstractDialogSelector.to_dict)rL   rM   rN   r   unionrd   rO   r0   r5   r:   rP   r   rQ   r_   rR   r   r   r*   r   r1   r6   r;   r	   re   dictri   __classcell__r$   r$   rn   r'   r\      sD    






r\   c                       s   e Zd ZdZdZdZdddddeded	eee	 ee
 f d
edee	ef def fddZede ddd Zdef fddZ  ZS )DialogStaticSelectorz
    Use the select element for multiple choice selections allowing users to pick a
    single item from a list. True to web roots, this selection is displayed as a
    dropdown menu.

    https://api.slack.com/dialogs#select_elements
    r^   d   FNra   r   r   optionsr   r   r   c                   s    t  j|||||d || _dS )a  
        Use the select element for multiple choice selections allowing users to pick
        a single item from a list. True to web roots, this selection is displayed as
        a dropdown menu.

        A select element may contain up to 100 selections, provided as a list of
        Option or OptionGroup objects

        https://api.slack.com/dialogs#attributes_select_elements

        Args:
            name: Name of form element. Required. No more than 300 characters.
            label: Label displayed to user. Required. No more than 48 characters.
            options: A list of up to 100 Option or OptionGroup objects. Object
                types cannot be mixed.
            optional: Provide true when the form element is not required. By
                default, form elements are required.
            value: Provide a default selected value.
            placeholder: A string displayed as needed to help guide users in
                completing the element. 150 character maximum.
        r   r   r   r   r   N)rh   r*   ru   )r&   r   r   ru   r   r   r   rn   r$   r'   r*      s   
zDialogStaticSelector.__init__z options attribute cannot exceed z itemsc                 C   r-   r#   )r/   ru   options_max_lengthr%   r$   r$   r'   options_length   r2   z#DialogStaticSelector.options_lengthr`   c                    sB   t   }t| jd trt| jd|d< |S t| jd|d< |S )Nr   rf   option_groupsru   )rh   ri   rj   ru   r   r   rl   rn   r$   r'   ri     s   
zDialogStaticSelector.to_dict)rL   rM   rN   rY   r_   rw   rQ   r   r   r   r   rR   r*   r   rx   rq   ri   rr   r$   r$   rn   r'   rs      s.    
(
rs   c                       @   e Zd ZdZdddddedededed	ef
 fd
dZ  ZS )DialogUserSelectorusersFNra   r   r   r   r   r   c                      t  j|||||d dS )aq  
        Now you can easily populate a select menu with a list of users. For example,
        when you are creating a bug tracking app, you want to include a field for an
        assignee. Slack pre-populates the user list in client-side, so your app
        doesn't need access to a related OAuth scope.

        https://api.slack.com/dialogs#dynamic_select_elements_users

        Args:
            name: Name of form element. Required. No more than 300 characters.
            label: Label displayed to user. Required. No more than 48 characters.
            optional: Provide true when the form element is not required. By
                default, form elements are required.
            value: Provide a default selected value.
            placeholder: A string displayed as needed to help guide users in
                completing the element. 150 character maximum.
        rv   Nrh   r*   rc   rn   r$   r'   r*     s   
zDialogUserSelector.__init__rL   rM   rN   r_   rQ   rR   r*   rr   r$   r$   rn   r'   r{          r{   c                       rz   )DialogChannelSelectorchannelsFNra   r   r   r   r   r   c                   r}   )a  
        You can also provide a select menu with a list of channels. Specify your
        data_source as channels to limit only to public channels

        https://api.slack.com/dialogs#dynamic_select_elements_channels_conversations

        Args:
            name: Name of form element. Required. No more than 300 characters.
            label: Label displayed to user. Required. No more than 48 characters.
            optional: Provide true when the form element is not required. By
                default, form elements are required.
            value: Provide a default selected value.
            placeholder: A string displayed as needed to help guide users in
                completing the element. 150 character maximum.
        rv   Nr~   rc   rn   r$   r'   r*   6  s   
zDialogChannelSelector.__init__r   r$   r$   rn   r'   r   3  r   r   c                       rz   )DialogConversationSelectorconversationsFNra   r   r   r   r   r   c                   r}   )a  
        You can also provide a select menu with a list of conversations - including
        private channels, direct messages, MPIMs, and whatever else we consider a
        conversation-like thing.

        https://api.slack.com/dialogs#dynamic_select_elements_channels_conversations

        Args:
            name: Name of form element. Required. No more than 300 characters.
            label: Label displayed to user. Required. No more than 48 characters.
            optional: Provide true when the form element is not required. By
                default, form elements are required.
            value: Provide a default selected value.
            placeholder: A string displayed as needed to help guide users in
                completing the element. 150 character maximum.
        rv   Nr~   rc   rn   r$   r'   r*   Z  s   
z#DialogConversationSelector.__init__r   r$   r$   rn   r'   r   W  r   r   c                       sl   e Zd ZdZedee f fddZdddddded	ed
ee	 dee
 dee def fddZ  ZS )DialogExternalSelectorr]   r`   c                    s   t  jdhS )Nmin_query_length)rh   rO   rp   r%   rn   r$   r'   rO     r2   z!DialogExternalSelector.attributesNF)r   r   r   r   r   r   r   r   r   r   c                   s    t  j|||||d || _dS )a  
        Use the select element for multiple choice selections allowing users to pick
        a single item from a list. True to web roots, this selection is displayed as
        a dropdown menu.

        A list of options can be loaded from an external URL and used in your dialog
        menus.

        https://api.slack.com/dialogs#dynamic_select_elements_external

        Args:
            name: Name of form element. Required. No more than 300 characters.
            label: Label displayed to user. Required. No more than 48 characters.
            min_query_length: Specify the number of characters that must be typed
                by a user into a dynamic select menu before dispatching to the app.
            optional: Provide true when the form element is not required. By
                default, form elements are required.
            value: Provide a default selected value. This should be a single
                Option or OptionGroup that exactly matches one that will be returned
                from your external endpoint.
            placeholder: A string displayed as needed to help guide users in
                completing the element. 150 character maximum.
        )r   r   r   r   r   N)rh   r*   r   )r&   r   r   r   r   r   r   rn   r$   r'   r*     s   !
zDialogExternalSelector.__init__)rL   rM   rN   r_   rP   r   rQ   rO   r   r   rS   rR   r*   rr   r$   r$   rn   r'   r   |  s*    r   N)abcr   r   typingr   r   r   r    r	   r
   r   r   objectsr   r   r   rJ   r   rV   rZ   r\   rs   r{   r   r   r   r$   r$   r$   r'   <module>   s    fBB&$%