<!--
  -   This file is a part of the SteamWar software.
  -
  -   Copyright (C) 2025 SteamWar.de-Serverteam
  -
  -   This program is free software: you can redistribute it and/or modify
  -   it under the terms of the GNU Affero General Public License as published by
  -   the Free Software Foundation, either version 3 of the License, or
  -   (at your option) any later version.
  -
  -   This program is distributed in the hope that it will be useful,
  -   but WITHOUT ANY WARRANTY; without even the implied warranty of
  -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  -   GNU Affero General Public License for more details.
  -
  -   You should have received a copy of the GNU Affero General Public License
  -   along with this program.  If not, see <https://www.gnu.org/licenses/>.
  -->

<script lang="ts">
    import EventEdit from "@components/moderator/pages/event/EventEdit.svelte";
    import EventFightList from "@components/moderator/pages/event/EventFightList.svelte";
    import RefereesList from "@components/moderator/pages/event/RefereesList.svelte";
    import TeamTable from "@components/moderator/pages/event/TeamTable.svelte";
    import type { EventModel } from "./eventmodel.svelte";

    let { event = $bindable(), refresh }: { event: EventModel; refresh: () => void } = $props();
</script>

<div class="flex flex-col m-4 p-4 rounded-md border gap-4">
    <div class="flex flex-col md:flex-row">
        <div class="md:w-1/3">
            <h1 class="text-2xl font-bold mb-4">{event.event.name}</h1>
            <EventEdit event={event.event} />
        </div>
        <div class="md:ml-4 md:pl-4 md:border-l md:w-1/3">
            <h2 class="text-xl font-bold mb-4">Teams</h2>
            <TeamTable bind:event />
        </div>
        <div class="md:ml-4 md:pl-4 md:border-l md:w-1/3">
            <h2 class="text-xl font-bold mb-4">Referees</h2>
            <RefereesList {event} />
        </div>
    </div>
    <EventFightList bind:data={event} {refresh} />
</div>
