@using FoodsharingSiegen.Contracts.Entity

<Modal @ref="ModalReference">
    <ModalContent Centered Size="ModalSize.Default">
        <ModalHeader>
            <h6>@_header</h6>
            <CloseButton/>
        </ModalHeader>
        <ModalBody>
            @if (_showNotNeeded)
            {
                <div class="row">
                    <div class="col">
                        <Field>
                            <Switch TValue="bool" @bind-Checked="Interaction.NotNeeded">Nicht benötigt</Switch>
                        </Field>
                    </div>
                    <div class="col">
                        <Field>
                            <Switch TValue="bool" @bind-Checked="Interaction.Alert">Achtung!</Switch>
                        </Field>
                    </div>
                </div>
            }

            <div class="row">
                <div class="col">
                    <Field>
                        <FieldLabel>Wer?</FieldLabel>
                        <Select TValue="Guid" @bind-SelectedValue="SelectedUser">
                            @foreach (var user in Users ?? new List<User>())
                            {
                                <SelectItem Value="@user.Id">@user.Name</SelectItem>
                            }
                        </Select>
                    </Field>
                </div>
                <div class="col">
                    <Field>
                        <FieldLabel>Wann?</FieldLabel>
                        <DatePicker TValue="DateTime" @bind-Date="Interaction.Date" ElementId="aim-datepicker" Max="DateTime.UtcNow.AddDays(7)"/>
                    </Field>
                </div>
            </div>

            @if (_showInfo)
            {
                <Field>
                    <FieldLabel>@_infoName</FieldLabel>
                    <TextEdit @bind-Text="Interaction.Info"></TextEdit>
                </Field>
            }
        </ModalBody>
        <ModalFooter>
            <Button Color="Color.Secondary" Clicked="ModalReference.Hide">Abbrechen</Button>
            <Button Color="Color.Primary" Clicked="@AddInteraction">Speichern</Button>
        </ModalFooter>
    </ModalContent>
</Modal>