# Owner Dashboard Logo Upload

**Goal:** Let an owner upload a custom logo that replaces the default "Turista" branding in their dashboard.

---

## Design

### Storage

Use Spatie Media Library (already installed and used by Building/Unit/PendingReservation):

- Make `Owner` implement `Spatie\MediaLibrary\HasMedia` and use `InteractsWithMedia`.
- Register a single-file `logo` media collection on `Owner` that accepts `image/jpeg`, `image/png`, `image/webp`, `image/heif`, `image/heic`.
- Media Library already provides the `media` table, so no new migration is needed for storage.

### Upload endpoint

Add under the owner-only route group:

```
POST /api/v1/owner/logo
```

Implemented in `OwnerProfileController::uploadLogo`.

Behavior:
- Validate `logo` image file.
- Compress the image through `ImageCompressor` (max long edge 2560, WebP/JPEG, quality 85) — same pipeline used for building/unit photos.
- Clear any existing logo and store the new one in the `logo` collection.
- Return the owner profile resource with the new `logo_url`.

### Validation

`UploadOwnerLogoRequest`:

```php
'logo' => ['required', 'image', 'mimetypes:image/jpeg,image/png,image/webp,image/heif,image/heic', 'max:5120'],
```

`image` + `mimetypes` covers standard image types. A 5 MB max is reasonable for a dashboard logo.

### Exposing the URL

- `OwnerResource`: add `logo_url` using `$this->getFirstMediaUrl('logo')`.
- `LoginResource`: when the authenticated user is an owner, include `logo_url` from `$user->owner?->getFirstMediaUrl('logo')` so the dashboard can render it immediately after login.
- `ProfileController::show()` already returns `OwnerResource` for owners, so the logo will appear on profile too.

### Fallback

If no logo is uploaded, `logo_url` returns an empty string; the frontend falls back to the default Turista logo.

## Testing

- `tests/Feature/Owner/OwnerLogoTest.php`:
  - Owner can upload a logo.
  - Logo URL appears on login response for owners.
  - Logo URL appears on profile response.
  - Uploading a second logo replaces the first.
  - Invalid file type is rejected.
  - Non-owner cannot upload a logo.

## Out of scope

- Admin UI for default Turista logo.
- Logo on building/unit public pages.
- SVG support (not covered by existing photo rules/compression).
