o
    ºªRh­#  ã                   @   sÎ   d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 ddl
mZ G dd	„ d	eƒZG d
d„ dee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G dd„ de	ƒZG dd„ de	ƒZdS )zlinebot.models.template module.é    )ÚABCMeta)Úwith_metaclassé   )Ú
get_actionÚget_actions)ÚBase)ÚSendMessagec                       ó"   e Zd ZdZd‡ fdd„	Z‡  ZS )ÚTemplateSendMessagea,  TemplateSendMessage.

    https://developers.line.biz/en/reference/messaging-api/#template-messages

    Template messages are messages with predefined layouts which you can customize.
    There are three types of templates available
    that can be used to interact with users through your bot.
    Nc                    s>   t t| ƒjdi |¤Ž d| _|| _|  |tttt	dœ¡| _
dS )a  __init__ method.

        :param str alt_text: Alternative text for unsupported devices.
        :param template: Object with the contents of the template.
        :type template: T <= :py:class:`linebot.models.template.Template`
        :param kwargs:
        Útemplate)ÚbuttonsÚconfirmÚcarouselÚimage_carouselN© )Úsuperr
   Ú__init__ÚtypeÚalt_textÚ$get_or_new_from_json_dict_with_typesÚButtonsTemplateÚConfirmTemplateÚCarouselTemplateÚImageCarouselTemplater   )Úselfr   r   Úkwargs©Ú	__class__r   úY/home/air/sanwanet/backup_V2/venv/lib/python3.10/site-packages/linebot/models/template.pyr   %   s   ü
ÿzTemplateSendMessage.__init__©NN©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__classcell__r   r   r   r   r
      s    	r
   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )ÚTemplatez Abstract Base Class of Template.c                    s    t t| ƒjdi |¤Ž d| _dS )z1__init__ method.

        :param kwargs:
        Nr   )r   r&   r   r   )r   r   r   r   r   r   >   s   
zTemplate.__init__r    r   r   r   r   r&   ;   s    r&   c                       s*   e Zd ZdZ				d‡ fdd„	Z‡  ZS )r   z©ButtonsTemplate.

    https://developers.line.biz/en/reference/messaging-api/#buttons

    Template message with an image, title, text, and multiple action buttons.
    Nc	           
         sX   t t| ƒjdi |	¤Ž d| _|| _|| _|| _|| _|| _|| _	t
|ƒ| _t|ƒ| _dS )ax  __init__ method.

        :param str text: Message text.
            Max: 160 characters (no image or title).
            Max: 60 characters (message with an image or title)
        :param str title: Title.
            Max: 40 characters
        :param str thumbnail_image_url: Image URL.
            HTTPS
            JPEG or PNG
            Aspect ratio: 1:1.51
            Max width: 1024px
            Max: 1 MB
        :param str image_aspect_ratio: Aspect ratio of the image.
            Specify one of the following values:
            rectangle: 1.51:1
            square: 1:1
        :param str image_size: Size of the image. Specify ``cover`` or ``contain``.
        :param str image_background_color: Background color of image.
            Specify a RGB color value.
        :param actions: Action when tapped.
            Max: 4
        :type actions: list[T <= :py:class:`linebot.models.actions.Action`]
        :param default_action: Action when image is tapped;
            set for the entire image, title, and text area
        :type default_action: T <= :py:class:`linebot.models.actions.Action`
        :param kwargs:
        r   Nr   )r   r   r   r   ÚtextÚtitleÚthumbnail_image_urlÚimage_aspect_ratioÚ
image_sizeÚimage_background_colorr   Úactionsr   Údefault_action)
r   r'   r(   r)   r*   r+   r,   r-   r.   r   r   r   r   r   P   s    
zButtonsTemplate.__init__)NNNNNNNNr    r   r   r   r   r   H   s    ýr   c                       r	   )r   z‰ConfirmTemplate.

    https://developers.line.biz/en/reference/messaging-api/#confirm

    Template message with two action buttons.
    Nc                    s0   t t| ƒjdi |¤Ž d| _|| _t|ƒ| _dS )a  __init__ method.

        :param str text: Message text.
            Max: 240 characters
        :param actions: Action when tapped.
            Max: 2
        :type actions: list[T <= :py:class:`linebot.models.actions.Action`]
        :param kwargs:
        r   Nr   )r   r   r   r   r'   r   r-   )r   r'   r-   r   r   r   r   r   …   s   
zConfirmTemplate.__init__r   r    r   r   r   r   r   }   ó    r   c                       s&   e Zd ZdZ		d‡ fdd„	Z‡  ZS )r   z­CarouselTemplate.

    https://developers.line.biz/en/reference/messaging-api/#carousel

    Template message with multiple columns which can be cycled like a carousel.
    Nc                    sV   t t| ƒjdi |¤Ž d| _g }|r |D ]}| |  |t¡¡ q|| _|| _|| _	dS )a‹  __init__ method.

        :param columns: Array of columns.
            Max: 10
        :type columns: list[T <= :py:class:`linebot.models.template.CarouselColumn`]
        :param str image_aspect_ratio: Aspect ratio of the image.
            Specify ``rectangle`` or ``square``.
        :param str image_size: Size of the image. Specify ``cover`` or ``contain``.
        :param kwargs:
        r   Nr   )
r   r   r   r   ÚappendÚget_or_new_from_json_dictÚCarouselColumnÚcolumnsr*   r+   )r   r3   r*   r+   r   Únew_columnsÚcolumnr   r   r   r   ž   s   ÿ
zCarouselTemplate.__init__)NNNr    r   r   r   r   r   –   s
    ÿr   c                       r	   )r   zÀImageCarouselTemplate.

    https://developers.line.biz/en/reference/messaging-api/#image-carousel

    Template message with multiple images columns which can be cycled like as carousel.
    Nc                    sJ   t t| ƒjdi |¤Ž d| _g }|r |D ]}| |  |t¡¡ q|| _dS )zÉ__init__ method.

        :param columns: Array of columns.
            Max: 10
        :type columns: list[T <= :py:class:`linebot.models.template.ImageCarouselColumn`]
        :param kwargs:
        r   Nr   )r   r   r   r   r0   r1   ÚImageCarouselColumnr3   )r   r3   r   r4   r5   r   r   r   r   Á   s   ÿ
zImageCarouselTemplate.__init__)Nr    r   r   r   r   r   ¹   r/   r   c                       s(   e Zd ZdZ			d‡ fdd„	Z‡  ZS )r2   z_CarouselColumn.

    https://developers.line.biz/en/reference/messaging-api/#column-object
    Nc                    sF   t t| ƒjdi |¤Ž || _|| _|| _|| _t|ƒ| _t	|ƒ| _
dS )aS  __init__ method.

        :param str text: Message text.
            Max: 120 characters (no image or title)
            Max: 60 characters (message with an image or title)
        :param str title: Title.
            Max: 40 characters
        :param str thumbnail_image_url: Image URL (HTTPS). JPEG or PNG. Aspect ration is 1:1.51.
            Max width: 1024px, Max: 1 MB.
        :param str image_background_color: Background color of image.
            Specify a RGB color value.
        :param actions: Action when tapped.
            Max: 3
        :type actions: list[T <= :py:class:`linebot.models.actions.Action`]
        :param default_action: Action when image is tapped;
            set for the entire image, title, and text area
        :type default_action: T <= :py:class:`linebot.models.actions.Action`
        :param kwargs:
        Nr   )r   r2   r   r'   r(   r)   r,   r   r-   r   r.   )r   r'   r(   r)   r,   r-   r.   r   r   r   r   r   Ü   s   
zCarouselColumn.__init__)NNNNNNr    r   r   r   r   r2   Ö   s    þr2   c                       r	   )r6   zwImageCarouselColumn.

    https://developers.line.biz/en/reference/messaging-api/#column-object-for-image-carousel
    Nc                    s*   t t| ƒjdi |¤Ž || _t|ƒ| _dS )a0  __init__ method.

        :param str image_url: Image URL (HTTPS). JPEG or PNG. Aspect ration is 1:1.
            Max width: 1024px, Max: 1 MB.
        :param action: Action when image is tapped. Max: 5.
        :type action: T <= :py:class:`linebot.models.actions.Action`
        :param kwargs:
        Nr   )r   r6   r   Ú	image_urlr   Úaction)r   r7   r8   r   r   r   r   r     s   	zImageCarouselColumn.__init__r   r    r   r   r   r   r6   ü   s    r6   N)r$   Úabcr   Úfuture.utilsr   r-   r   r   Úbaser   Úsend_messagesr   r
   r&   r   r   r   r   r2   r6   r   r   r   r   Ú<module>   s    5#&