<?php

namespace App\Http\Resources\Backoffice\Accounts;

use App\Http\Resources\CountryResource;
use Illuminate\Http\Resources\Json\JsonResource;

class AddressDetailResource extends JsonResource
{
    private $sameAsCompany;

    public function __construct($resource, $sameAsCompany = false)
    {
        $this->sameAsCompany = $sameAsCompany;
        parent::__construct($resource);
    }

    /**
     * Transform the resource into an array.
     *
     * @param \Illuminate\Http\Request $request
     * @return array
     */

    public function toArray($request)
    {
        return [
            'name' => $this->name,
            'address' => $this->address,
            'floor' => $this->floor,
            'postalCode' => $this->postal_code,
            'location' => $this->location,
            'countryId' => $this->country_id,
            'phonePrefix' => $this->phone_prefix,
            'phone' => $this->phone,
            'sameAsCompany' => $this->sameAsCompany,
        ];
    }
}
