@props([
  'minimize' => true,
  'maximize' => false,
  'restore' => true,
  'help' => false,
  'close' => true,
  'dismissible' => false,
])

@aware([
  'title' => config('app.name', 'Laravel'),
])

@php
  if ($restore) {
    $maximize = false;
  }

  if ($dismissible) {
    $close = true;
  }
@endphp

<div
  {{ $attributes->merge(['class' => 'window']) }}
  {!! $dismissible ? 'x-data="{ show: true }" x-show="show"' : '' !!}
>
  <div class="title-bar">
    <div class="title-bar-text">{{ $title }}</div>

    @if ($minimize || $maximize || $restore || $help || $close)
      <div class="title-bar-controls">
        @if ($minimize)
          <button class="minimize" aria-hidden="true"></button>
        @endif

        @if ($maximize)
          <button class="maximize" aria-hidden="true"></button>
        @endif

        @if ($restore)
          <button class="restore" aria-hidden="true"></button>
        @endif

        @if ($help)
          <button class="help" aria-hidden="true"></button>
        @endif

        @if ($close)
          <button
            class="close"
            aria-hidden="true"
            {!! $dismissible ? 'x-on:click="show = false"' : '' !!}
          ></button>
        @endif
      </div>
    @endif
  </div>

  <div class="window-body">{{ $slot }}</div>

  @isset($status_bar)
    <div class="status-bar">{{ $status_bar }}</div>
  @endisset
</div>
