<?php

namespace App\Http\Resources;

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

class PipelineStageResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->uuid,
            'code' => $this->code,
            'name' => $this->name,
            'sequence' => $this->sequence,
            'applicant_label' => $this->publicLabel(),
            'applicant_description' => $this->applicant_visible_description,
            'is_visible_to_applicant' => (bool) $this->is_visible_to_applicant,
            'color' => $this->color,
            'icon' => $this->icon,
            'is_initial' => (bool) $this->is_initial,
            'is_terminal' => (bool) $this->is_terminal,
            'is_exception' => (bool) $this->is_exception,
            'requires_approval' => (bool) $this->requires_approval,
            'sla_days' => $this->sla_days,
            'entry_requirements' => $this->entry_requirements ?? [],
        ];
    }
}
