@php
    $website = $website ?? null;
@endphp

<div class="form-grid">
    <label>
        <span>Website Name</span>
        <input class="field" type="text" name="name" value="{{ old('name', $website?->name) }}" required>
    </label>

    <label>
        <span>Domain</span>
        <input class="field" type="text" name="domain" value="{{ old('domain', $website?->domain) }}" required>
    </label>

    <label>
        <span>Connection Type</span>
        <select class="field" name="connection_type" required>
            @foreach (['api_agent' => 'API Agent', 'local_harness' => 'Local Harness', 'custom_agent' => 'Custom Agent'] as $value => $label)
                <option value="{{ $value }}" @selected(old('connection_type', $website?->connection_type ?? 'api_agent') === $value)>
                    {{ $label }}
                </option>
            @endforeach
        </select>
    </label>

    <label>
        <span>API Endpoint</span>
        <input class="field" type="url" name="api_endpoint" value="{{ old('api_endpoint', $website?->api_endpoint) }}" required>
    </label>

    <label>
        <span>API Key</span>
        <input class="field" type="text" name="api_key" value="{{ old('api_key', $website?->api_key) }}" required>
    </label>

    <label>
        <span>Signing Secret</span>
        <input class="field" type="text" name="signing_secret" value="{{ old('signing_secret', $website?->signing_secret) }}">
    </label>
</div>

<label>
    <span>Description</span>
    <textarea class="field textarea" name="description" rows="4">{{ old('description', $website?->description) }}</textarea>
</label>
