<?php

namespace App\Modules\Pc\Controllers;

use App\Base\BaseController;
use App\Modules\Mini\Services\PageService;
use Faker\Provider\Image;

class GoodsController extends BaseController
{
    protected PageService $service;

    /**
     * @param PageService $service
     */
    public function __construct(PageService $service)
    {
        $this->service = $service;
    }

    public function goods()
    {
        return $this->ok([
            "id" => 1,
            "image_list" => [
                Image::imageUrl(),
                Image::imageUrl(),
            ],
            "spec" => [
                "id" => 1,
                "name" => "颜色",
                "attr" => [
                    [
                        "id" => 1,
                        "name" => "红色",
                    ],
                ],
            ],
            "sku" => [
                [
                    "id" => 1,
                    "sn" => "sn",
                    "url_3d" => "",
                    "spec_attr" => [
                        [
                            "id" => 1,
                            "name" => "白色",
                        ],
                        [
                            "id" => 3,
                            "name" => "大号",
                        ],
                    ],
                ],
            ],
            "desc_html" => "<h1>desc_html</h1>",
            "spec_attr_html" => "<h1>desc_html</h1>",
            "faq_html" => "<h1>desc_html</h1>",
        ]);
    }

    public function search()
    {
        return $this->ok([
            "total" => 1,
            "page_total" => 1,
            "list" => [
                [
                    "id" => 1,
                    "name" => "商品名称",
                    "thumb" => Image::imageUrl(),
                ],
            ],
            "category" => [
                [
                    "id" => 1,
                    "thumb" => Image::imageUrl(),
                    "name" => "分类名称",
                ],
            ],
        ]);
    }

    public function fav()
    {
        return $this->ok();
    }

    public function ask()
    {
        return $this->ok([
            "id" => 1,
            "thumb" => Image::imageUrl(),
            "name" => "商品名称",
        ]);
    }
}