<?php

namespace App\Http\Resources\Backoffice\CompanyProfiles;

use App\Helpers\Backoffice\MediaHelper;
use Illuminate\Http\Resources\Json\JsonResource;

class CompanyProfileDetailResource extends JsonResource
{
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'accountId' => $this->account_id,
            'name' => $this->name,
            'employeeCount' => $this->employee_count,
            'email' => $this->email,
            'phonePrefix' => $this->phone_prefix,
            'phone' => $this->phone,
            'websiteUrl' => $this->website_url,
            'subtitle' => $this->subtitle,
            'location' => $this->location,
            'description' => $this->description,
            'instagramUrl' => $this->instagram_url,
            'linkedinUrl' => $this->linkedin_url,
            'facebookUrl' => $this->facebook_url,
            'companyImage' => MediaHelper::getCompanyImageUrl($this->company_image, '600x'),
            'companyImageName' => $this->company_image,
            'coverImage' => MediaHelper::getCompanyImageUrl($this->cover_image, '1200x'),
            'coverImageOriginal' => $this->cover_image_original,
            'coverImageSize' => $this->cover_image_size,
            'isActive' => (bool) $this->is_active,
            'specialisationIds' => $this->companySpecialisations?->pluck('id') ?? [],
            'createdAt' => $this->created_at,
            'updatedAt' => $this->updated_at,
        ];
    }
}
