<?php

namespace App\Classes\Modules\Segments\ControllersLogic;


use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Segments\Services\ListsSegments;
use App\Http\Resources\AirShipmentItemPriceResource;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class ListAirShipmentPriceLogic extends AbstractControllerLogic
{

    /**
     * @return array
     */
    protected function notification():array {
        return [
            'title' => 'Retrieved Air Shipment Price List',
            'message' => 'You have successfully retrieved a list of Air Shipment Price'
        ];
    }


    /** @var ListsSegments */
    private $listsSegments;

    /**
     * ListSegmentLogic constructor.
     * @param ListsSegments $listsSegments
     */
    public function __construct(ListsSegments $listsSegments)
    {
        $this->listsSegments = $listsSegments;
    }

    /**
     * @param Request $request
     * @return JsonResponse
     * @throws \App\Classes\Exceptions\MalformedRequestException
     */
    public function logic(Request $request) : JsonResponse
    {

        // $query = $this->listsSegments->execute($this->listsSegments->deserializeFilters($request->input('filters')));

        // category - Dimension / perKg
        $price = array(

            [
                'details' => json_encode([
                    'name' => 'Sound system speakers - MINI',
                    'pricePerKg' => '',
                    'pricePerPcs' => '',
                    'isProhibited' => '',
                    'hasGram' => '',
                    'hasDimensionCharges' => '',
                    'tax' => '50',
                ])
            ],
            [
                'details' => json_encode([
                    'name' => 'Sound system speakers - SMALL',
                    'pricePerKg' => '',
                    'pricePerPcs' => '',
                    'isProhibited' => '',
                    'hasGram' => '',
                    'hasDimensionCharges' => '',
                    'tax' => '200',
                ])
            ],
            [
                'details' => json_encode([
                    'name' => 'Sound system speakers - LARGE',
                    'pricePerKg' => '',
                    'pricePerPcs' => '',
                    'isProhibited' => '',
                    'hasGram' => '',
                    'hasDimensionCharges' => '',
                    'tax' => '400',
                ])
            ],
            [
                'details' => json_encode([
                    'name' => 'Washing Machine - Dimension',
                    'pricePerKg' => '',
                    'pricePerPcs' => '',
                    'isProhibited' => '',
                    'hasGram' => '',
                    'hasDimensionCharges' => 'true',
                    'tax' => '',
                ])
            ],
            [
                'details' => json_encode([
                    'name' => 'Oven, Balnder - perPcs',
                    'pricePerKg' => '',
                    'pricePerPcs' => '20',
                    'isProhibited' => '',
                    'hasGram' => '',
                    'hasDimensionCharges' => '',
                    'tax' => '',
                ])
            ],
            [
                'details' => json_encode([
                    'name' => 'Perfume - perKg',
                    'pricePerKg' => '33',
                    'pricePerPcs' => '',
                    'isProhibited' => '',
                    'hasGram' => '',
                    'hasDimensionCharges' => '',
                    'tax' => '',
                ])
            ],
            [
                'details' => json_encode([
                    'name' => 'Gold - Prohibited',
                    'pricePerKg' => '',
                    'pricePerPcs' => '',
                    'isProhibited' => 'true',
                    'hasGram' => '',
                    'hasDimensionCharges' => '',
                    'tax' => '',
                ])
            ],
            [
                'details' => json_encode([
                    'name' => 'Food - hasGram',
                    'pricePerKg' => '',
                    'pricePerPcs' => '',
                    'isProhibited' => '',
                    'hasGram' => 'true',
                    'hasDimensionCharges' => '',
                    'tax' => '',
                ])
            ],
            [
                'details' => json_encode([
                    'name' => 'TV 30" - 36"',
                    'pricePerKg' => 28,
                    'pricePerPcs' => '',
                    'isProhibited' => '',
                    'hasGram' => 'true',
                    'hasDimensionCharges' => "true",
                    'tax' => 500,
                ])
            ],
            [
                'details' => json_encode([
                    'name' => 'TV 37" - 42"',
                    'pricePerKg' => 28,
                    'pricePerPcs' => '',
                    'isProhibited' => '',
                    'hasGram' => 'true',
                    'hasDimensionCharges' => "true",
                    'tax' => 1000,
                ])
            ],
            [
                'details' => json_encode([
                    'name' => 'TV 43"+"',
                    'pricePerKg' => 28,
                    'pricePerPcs' => '',
                    'isProhibited' => '',
                    'hasGram' => 'true',
                    'hasDimensionCharges' => "true",
                    'tax' => 1500,
                ])
            ]
        );

        return $this->collectionResponse(AirShipmentItemPriceResource::collection($price));

    }

}