#:import _ electrum.gui.kivy.i18n._
#:import KIVY_GUI_PATH electrum.gui.kivy.KIVY_GUI_PATH
#:import pr_color electrum.invoices.pr_color
#:import PR_UNKNOWN electrum.invoices.PR_UNKNOWN
#:import Factory kivy.factory.Factory
#:import Decimal decimal.Decimal


<RequestLabel@Label>
    #color: .305, .309, .309, 1
    text_size: self.width, None
    halign: 'left'
    valign: 'top'

<RequestItem@CardItem>
    address: ''
    memo: ''
    amount: ''
    status_str: ''
    status: PR_UNKNOWN
    BoxLayout:
        spacing: '8dp'
        height: '32dp'
        orientation: 'vertical'
        Widget
        RequestLabel:
            text: root.memo
            shorten: True
        Widget
        RequestLabel:
            text: root.address
            color: .699, .699, .699, 1
            font_size: '13sp'
            shorten: True
        Widget
    BoxLayout:
        spacing: '8dp'
        height: '32dp'
        orientation: 'vertical'
        Widget
        RequestLabel:
            text: root.amount
            halign: 'right'
            font_size: '15sp'
        Widget
        RequestLabel:
            text: root.status_str
            halign: 'right'
            font_size: '13sp'
            color: pr_color[root.status]
        Widget

<RequestRecycleView>:
    viewclass: 'RequestItem'
    RecycleBoxLayout:
        default_size: None, dp(56)
        default_size_hint: 1, None
        size_hint: 1, None
        height: self.minimum_height
        orientation: 'vertical'


<ReceiveScreen>:
    id: s
    name: 'receive'
    address: ''
    amount: ''
    message: ''
    status: ''
    expiration_text: _('Expiry')

    BoxLayout
        padding: '12dp', '12dp', '12dp', '12dp'
        spacing: '12dp'
        orientation: 'vertical'

        SendReceiveBlueBottom:
            id: blue_bottom
            size_hint: 1, None
            height: self.minimum_height
            BoxLayout:
                size_hint: 1, None
                height: blue_bottom.item_height
                spacing: '5dp'
                Image:
                    source: f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/calculator'
                    opacity: 0.7
                    size_hint: None, None
                    size: '22dp', '22dp'
                    pos_hint: {'center_y': .5}
                BlueButton:
                    id: amount_label
                    default_text: _('Amount')
                    text: s.amount if s.amount else _('Amount')
                    on_release: Clock.schedule_once(lambda dt: app.amount_dialog(s, False))
            CardSeparator:
                opacity: message_selection.opacity
                color: blue_bottom.foreground_color
            BoxLayout:
                id: message_selection
                opacity: 1
                size_hint: 1, None
                height: blue_bottom.item_height
                spacing: '5dp'
                Image:
                    source: f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/pen'
                    size_hint: None, None
                    size: '22dp', '22dp'
                    pos_hint: {'center_y': .5}
                BlueButton:
                    id: description
                    text: s.message if s.message else _('Description')
                    on_release: Clock.schedule_once(lambda dt: app.description_dialog(s))
            CardSeparator:
                opacity: message_selection.opacity
                color: blue_bottom.foreground_color
            BoxLayout:
                id: message_selection
                opacity: 1
                size_hint: 1, None
                height: blue_bottom.item_height
                spacing: '5dp'
                Image:
                    source: f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/clock1'
                    size_hint: None, None
                    size: '22dp', '22dp'
                    pos_hint: {'center_y': .5}
                BlueButton:
                    id: description
                    text: s.expiration_text
                    on_release: Clock.schedule_once(lambda dt: s.expiration_dialog(s))
        BoxLayout:
            size_hint: 1, None
            height: '48dp'
            Button:
                text: _('Clear')
                size_hint: 1, None
                height: '48dp'
                on_release: Clock.schedule_once(lambda dt: s.clear())
            Button:
                text: _('New Request')
                size_hint: 1, None
                height: '48dp'
                on_release: Clock.schedule_once(lambda dt: s.new_request())
        Widget:
            size_hint: 1, 0.1
        RequestRecycleView:
            id: requests_container
            scroll_type: ['bars', 'content']
            bar_width: '25dp'
