from django import forms
from django.forms import formset_factory


class LineupEntryForm(forms.Form):
    member = None
    availability = None
    lineup_entry = None

    event_lineup_entry_id = forms.Field(required=False)
    event_lineup_id = forms.Field(required=False)
    event_id = forms.Field()
    member_id = forms.Field()
    position_only = forms.BooleanField(initial=False, required=False)
    sequence = forms.IntegerField(required=False)
    label = forms.ChoiceField(
        required=False,
        choices=[
            ("", "--"),
            ("P", "P"),
            ("C", "C"),
            ("1B", "1B"),
            ("2B", "2B"),
            ("3B", "3B"),
            ("SS", "SS"),
            ("LF", "LF"),
            ("CF", "CF"),
            ("RF", "RF"),
            ("DH", "DH"),
            ("DR", "DR"),
            ("EH", "EH"),
        ],
        widget=forms.Select(attrs={"onchange": "positionSelectChanged(this);"}),
    )


LineupEntryFormset = formset_factory(
    LineupEntryForm, can_delete=True, can_order=True, extra=0
)


class EventChooseForm(forms.Form):
    event_id = forms.ChoiceField()


LineupEntryFormset = formset_factory(
    LineupEntryForm, can_delete=True, can_order=True, extra=0
)
