<?php

namespace App\Http\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class SpecDocumentSectionResource extends JsonResource
{
    public static $wrap = '';

    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    #[\Override]
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'spec_document_id' => $this->spec_document_id,
            'type' => $this->type,
            'title' => $this->title,
            'sort_order' => $this->sort_order,
            'data' => $this->data,
            'is_completed' => $this->completed_at !== null,
            'completed_at' => $this->completed_at,
            'updated_at' => $this->updated_at,
        ];
    }
}
