<?php

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

use App\Api\Resources\BaseCollection;

class ShopCollection extends BaseCollection
{

    public function toArray($request): array
    {
        return [
            'data' => $this->collection->map(function ($shop) {
                return [
                    'shop_id'     => $shop->id,
                    'name'        => $shop->name,
                    'is_self'     => (bool) $shop->is_self,
                    'mobile'      => $shop->mobile,
                    'description' => $shop->description,
                    'cover'       => $shop->cover_url,
                ];
            }),
            'page' => $this->page(),
        ];
    }

}