""" This module holds the forms of the ``brainstormers`` app. """

from django import forms
from django.forms.widgets import HiddenInput

from .models import (
    Brainstormer,
    BrainstormerProposition,
    BrainstormerPropositionGroup,
    BrainstormerTemplate
)


class BrainstormerForm(forms.ModelForm):
    """ Form for Brainstormer. """

    class Meta:
        model = Brainstormer
        fields = ('name', 'session', 'brainstormer_type')
        widgets = {
            'session': HiddenInput(),
            'brainstormer_type': HiddenInput()
        }


class BrainstormerTemplateForm(forms.ModelForm):
    """ Form for Brainstormer Template. """

    class Meta:
        model = BrainstormerTemplate
        fields = ('name', 'training')
        widgets = {
            'training': HiddenInput()
        }


class BrainstormerTemplateOrderForm(forms.ModelForm):
    """ Form to edit Brainstormer Template order. """

    class Meta:
        model = BrainstormerTemplate
        fields = ('sort_order',)


class BrainstormerPropositionGroupForm(forms.ModelForm):
    """ Form for Brainstormer Proposition Group. """

    name = forms.CharField(required=True)

    class Meta:
        model = BrainstormerPropositionGroup
        fields = ('name', 'color', 'brainstormer')
        widgets = {
            'brainstormer': HiddenInput()
        }


class BrainstormerPropositionForm(forms.ModelForm):
    """ Form for Brainstormer Proposition. """

    class Meta:
        model = BrainstormerProposition
        fields = ('text', 'groups', 'user')
        widgets = {
            'groups': HiddenInput()
        }
