<?php

namespace App\Http\Resources;

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

class UserTypePermissionResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray(Request $request): array
    {
        return [
            'id'                 => $this->id,
            'scope'              => $this->permission->scope,
            'user_permission_id' => $this->permission_id,
            'description'        => $this->permission->description,
            'parent_id'          => $this->permission->parent_id,
            'bits'               => $this->bits,
        ];
    }

    public static function collection($resource): AnonymousResourceCollection
    {
        return parent::collection($resource);
    }
}
