<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class ProductResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id'                        => $this->id,
            'sku'                       => $this->sku,
            'name'                      => $this->name,
            'slug'                      => $this->slug,
            'sub_title'                 => $this->sub_title,
            'group'                     => $this->group,
            'image'                     => ($this->image == null || $this->image == "") ? 'no-image.png' : $this->image,
            'images'                    => $this->images,
            'description'               => $this->description,
            'regular_price_from'        => $this->regular_price_from,
            'regular_price_to'          => $this->regular_price_to,
            'discount'                  => $this->discount,
            'price_from'                => $this->price_from,
            'price_to'                  => $this->price_to,
            'standard_construction_fee' => $this->standard_construction_fee,
            'shipping_cost'             => $this->shipping_cost,
            'note'                      => $this->note,
            'policy'                    => $this->policy,
            'possible_delivery_time'    => $this->possible_delivery_time,
            'wish_list'                 => $this->wish_list,
            'category_id'               => $this->category_id,
            'category'                  => $this->category,
            'manufacturer_id'           => $this->manufacturer_id,
            'manufacturer'              => $this->manufacturer,
            'purchases'                 => $this->purchases,
        ];
    }
}
