<?php

namespace Themes\Pro\modunawa\app\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Services\CallApiService;

class IndexController extends Controller
{
    private $callApiService;

    public function __construct(CallApiService $callApiService)
    {
        $this->callApiService = $callApiService;
    }

    public function index()
    {
        $listType1Book = $this->callApiService->callApi([
            'url' => 'list-type1-book',
            'data' => [
                'Book' => [
                    [
                        'QueryVars' => [
                            'QueryName' => 'pro/widget-taxo',
                            'SimpleFilter' => "mx.taxo_code='ma-main-slider'",
                            'IsntPagination' => true,
                        ],
                        'PageVars' => [
                            'Limit' => 10
                        ]
                    ],
                    [
                        'QueryVars' => [
                            'QueryName' => 'pro:shop/item-taxo',
                            'SimpleFilter' => "mx.item_taxo_no='best'",
                            'SubSimpleFilter' => "image_type = 'thumb'",
                            'IsntPagination' => true,
                        ],
                        'PageVars' => [
                            'Limit' => 10
                        ]
                    ],
                    [
                        'QueryVars' => [
                            'QueryName' => 'pro:shop/item-taxo',
                            'SimpleFilter' => "mx.item_taxo_no='weekly-best'",
                            'SubSimpleFilter' => "image_type = 'thumb'",
                            'IsntPagination' => true,
                        ],
                        'PageVars' => [
                            'Limit' => 10
                        ]
                    ],
                    [
                        'QueryVars' => [
                            'QueryName' => 'pro:shop/item-taxo',
                            'SimpleFilter' => "mx.item_taxo_no='with-coin'",
                            'SubSimpleFilter' => "image_type = 'middle'",
                            'IsntPagination' => true,
                        ],
                        'PageVars' => [
                            'Limit' => 10
                        ]
                    ],
                    [
                        'QueryVars' => [
                            'QueryName' => 'pro:shop/item-taxo',
                            'SimpleFilter' => "mx.item_taxo_no='gift-coupon'",
                            'SubSimpleFilter' => "image_type = 'middle'",
                            'IsntPagination' => true,
                        ],
                        'PageVars' => [
                            'Limit' => 10
                        ]
                    ],
                ]
            ]
        ]);

//        dump($listType1Book);
        return view('views.index', compact('listType1Book'));
    }
}
