<?php

namespace App\Http\Resources\Admin;

use Illuminate\Http\Resources\Json\JsonResource;

class ProductListResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id'                        => $this->id,
            'categories'                => $this->category,
            'color_detail'              => $this->color_detail,
            'sku'                       => $this->sku,
            'name'                      => $this->name,
            'slug'                      => $this->slug,
            'type'                      => $this->type,
            'image'                     => $this->image,
            'default_price'             => $this->default_price,
            'discount'                  => $this->discount,
            'view'                      => $this->view,
            'user'                      => $this->user,
            'is_allow_faceswap'         => $this->is_allow_faceswap,
            'is_pricing_manual'         => $this->is_pricing_manual,
            'is_activated'              => $this->is_activated,
            'created_at'                => isset($this->created_at) ? date('Y-m-d H:i:s', strtotime($this->created_at)) : null,
        ];
    }
}
