<?php

namespace App\Domains\Ticket\Resources\Scanner;

use App\Domains\Ticket\Models\Ticket;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

/** @mixin Ticket */
class ScannedTicketResource extends JsonResource
{
    /** @return array<string, mixed> */
    public function toArray(Request $request): array
    {
        return [
            'product' => $this->name,
            'id' => $this->id,
            'ticket' => $this->ticket,
            'used_at' => $this->used_at,
            'expires_at' => $this->getEffectiveExpiresAt(),
            'status' => $this->status,
        ];
    }
}
