<?php

declare(strict_types=1);

namespace App\Http\Resources\Api\V1;

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

class ResellerResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'user_id' => $this->user_id,
            'is_active' => $this->is_active,
            'limits' => [
                'max_accounts' => $this->max_accounts,
                'max_disk_mb' => $this->max_disk_mb,
                'max_bandwidth_mb_month' => $this->max_bandwidth_mb_month,
                'max_databases' => $this->max_databases,
                'max_email_accounts' => $this->max_email_accounts,
                'max_domains' => $this->max_domains,
                'max_subdomains' => $this->max_subdomains,
                'max_ftp_accounts' => $this->max_ftp_accounts,
            ],
            'allowed_package_ids' => $this->allowed_package_ids,
            'white_label' => [
                'enabled' => $this->white_label_enabled,
                'brand_name' => $this->white_label_brand_name,
                'logo_url' => $this->white_label_logo_url,
                'primary_color' => $this->white_label_primary_color,
                'panel_domain' => $this->white_label_panel_domain,
            ],
            'permissions' => $this->permissions,
            'created_at' => $this->created_at?->toIso8601String(),
            'links' => [
                'self' => route('api.v1.resellers.show', $this->id),
            ],
        ];
    }
}
