<?php

namespace App\Http\Resources;

use App\Models\Category;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Storage;

class ProductResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @return array<string, mixed>
     */
    public function toArray($request)
    {
        return [
            "id" => $this->id,
            "category_id" => $this->category_id,
            "thumbnail" => Storage::url($this->thumbnail),
            "name" => $this->name,
            "description" => $this->description,
            "shopee" => $this->shopee,
            "url_shopee" => $this->url_shopee,
            "tokopedia" => $this->tokopedia,
            "url_tokopedia" => $this->url_tokopedia,
            "tiktok" => $this->tiktok,
            "url_tiktok" => $this->url_tiktok,
        ];
    }
}
