<?php declare(strict_types=1); namespace App\Attributes; use AllowDynamicProperties; use App\Responses\Dto; use App\Services\ResponseService; use Attribute; use Illuminate\Support\Str; use Knuckles\Scribe\Attributes\Response as ResponseAttribute; #[AllowDynamicProperties] #[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_FUNCTION | Attribute::TARGET_METHOD | Attribute::TARGET_CLASS)] class OpenApiPaginatedResponse extends ResponseAttribute { public function __construct( /** @var Dto $dto */ public ?string $dto, public ?string $event = 'ok', public int $status = 200, ) { } public function toArray(): array { return [ 'status' => $this->status, 'content' => ResponseService::array($this->dto::example($this->event, $this->dto), true), 'description' => Str::headline($this->event), ]; } }