<?php

namespace App\DTOs;

use App\Models\User;
use Illuminate\Pagination\LengthAwarePaginator;

class DashboardDataDto
{
    public function __construct(
        public readonly LengthAwarePaginator $administrations,
        public readonly string $selectedMonth,
        public readonly User $user,
        public readonly array $receivedRankers,
        public readonly ?object $receivedCurrentUserRankItem,
        public readonly array $sentRankers,
        public readonly ?object $sentCurrentUserRankItem,
        public readonly int $receivedCount,
        public readonly int $sentCount,
        public readonly int $currentRank
    ) {}

    /**
     * Convert the DTO to an associative array for view rendering.
     */
    public function toArray(): array
    {
        return [
            'administrations'             => $this->administrations,
            'selectedMonth'               => $this->selectedMonth,
            'user'                        => $this->user,
            'receivedRankers'             => $this->receivedRankers,
            'receivedCurrentUserRankItem' => $this->receivedCurrentUserRankItem,
            'sentRankers'                 => $this->sentRankers,
            'sentCurrentUserRankItem'     => $this->sentCurrentUserRankItem,
            'receivedCount'               => $this->receivedCount,
            'sentCount'                   => $this->sentCount,
            'currentRank'                 => $this->currentRank,
        ];
    }
}
