<?php

namespace Modules\Mall\Http\Resources\Api\Shop;

use Illuminate\Http\Resources\Json\JsonResource;

class ShopEditResource extends JsonResource
{

    public function toArray($request): array
    {
        return [
            'shop_id'     => $this->id,
            'name'        => $this->name,
            'mobile'      => $this->mobile,
            'cover'       => $this->cover_url,
            'description' => $this->description,
            'province'    => [
                'id'   => $this->province_id,
                'name' => $this->province->name,
            ],
            'city'        => [
                'id'   => $this->city_id,
                'name' => $this->city->name,
            ],
            'district'    => [
                'id'   => $this->district_id,
                'name' => $this->district->name,
            ],
            'address'     => $this->address ?? '',
            'created_at'  => (string) $this->created_at,
        ];
    }

}
