# -*- coding: utf-8 -*-
from __future__ import annotations

from crispy_forms.layout import Submit
from django import forms
from django.utils.translation import gettext_lazy as _

from hotpocket_backend.apps.ui.forms.base import ConfirmationMixin, Form


class AppForm(Form):
    pass


class ConfirmationForm(ConfirmationMixin, AppForm):
    origin_app = forms.CharField(
        label=_('App'),
        required=False,
        disabled=True,
        show_hidden_initial=True,
    )
    platform = forms.CharField(
        label=_('Platform'),
        required=False,
        disabled=True,
        show_hidden_initial=True,
    )
    version = forms.CharField(
        label=_('Version'),
        required=False,
        disabled=True,
        show_hidden_initial=True,
    )

    def get_layout_fields(self) -> list[str]:
        return [
            'canhazconfirm',
            'origin_app',
            'platform',
            'version',
        ]


class DeleteForm(ConfirmationForm):
    def get_submit_button(self) -> Submit:
        return Submit('submit', _('Delete'), css_class='btn btn-danger')
