<?php

namespace App\Domains\Bootstrap\Resources;

use App\Domains\Tenant\Models\WebsiteType;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

/** @mixin array{website_type: WebsiteType} */
class AdminAppBootstrapResource extends JsonResource
{
    /** @return array<string, mixed> */
    public function toArray(Request $request): array
    {
        /** @var WebsiteType $websiteType */
        $websiteType = $this->resource['website_type'];

        return [
            'website_type_code' => $websiteType->codigo,
            'primary_color' => $websiteType->primary_color,
            'secondary_color' => $websiteType->secondary_color,
            'danger_color' => $websiteType->danger_color,
            'success_color' => $websiteType->success_color,
            'warning_color' => $websiteType->warning_color,
            'body_color' => $websiteType->body_color,
            'darker_body_color' => $websiteType->darker_body_color,
            'surface_color' => $websiteType->surface_color,
            'background_color' => $websiteType->background_color,
            'border_color' => $websiteType->border_color,
            'login_header_footer_color' => $websiteType->login_header_footer_color,
            'site_logo' => $websiteType->siteLogo?->getTemporaryUrl(1440),
            'footer_logo' => $websiteType->footerLogo?->getTemporaryUrl(1440),
            'favicon' => $websiteType->favicon?->getTemporaryUrl(1440),
        ];
    }
}
