<?php

namespace App\Http\Resources\Incidents;

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

class IncidentResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->resource['id'] ?? null,
            'student_id' => $this->resource['student_id'] ?? null,
            'student_name' => $this->resource['student_name'] ?? null,
            'grade' => $this->resource['grade'] ?? null,
            'incident' => $this->resource['incident'] ?? null,
            'incident_datetime' => $this->resource['incident_datetime'] ?? null,
            'incident_state' => $this->resource['incident_state'] ?? null,
            'updated_by_open' => $this->resource['updated_by_open'] ?? null,
            'updated_by_open_name' => $this->resource['updated_by_open_name'] ?? null,
            'open_description' => $this->resource['open_description'] ?? null,
            'updated_by_closed' => $this->resource['updated_by_closed'] ?? null,
            'updated_by_closed_name' => $this->resource['updated_by_closed_name'] ?? null,
            'close_description' => $this->resource['close_description'] ?? null,
            'action_taken' => $this->resource['action_taken'] ?? null,
            'updated_by_canceled' => $this->resource['updated_by_canceled'] ?? null,
            'updated_by_canceled_name' => $this->resource['updated_by_canceled_name'] ?? null,
            'cancel_description' => $this->resource['cancel_description'] ?? null,
            'semester' => $this->resource['semester'] ?? null,
            'school_year' => $this->resource['school_year'] ?? null,
            'created_at' => $this->resource['created_at'] ?? null,
            'updated_at' => $this->resource['updated_at'] ?? null,
        ];
    }
}
