<?php

namespace App\Classes\Modules\KeyValuePairs\ControllersLogic;

use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\KeyValuePairs\DataTransferObjects\KeyValuePairObject;
use App\Classes\Modules\Bookings\Standards\Rules\CanCreateBooking;
use App\Classes\Modules\KeyValuePairs\Services\CreatesKeyValuePair;
use App\Classes\ValueObjects\Constants\KVPKey;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class CreateLockLogic extends AbstractControllerLogic
{

    /**
     * @return array
     */
    protected function notification():array {
        return [
            'title' => 'Lock Created',
            'message' => 'You have successfully created a lock'
        ];
    }

    // /** @var CanCreateBooking */
    // private $canCreateBooking;

    /** @var CreatesKeyValuePair */
    private $createsKeyValuePair;

    /**
     * CreateLockLogic constructor.
     * @param CanCreateBooking $canCreateBooking
     * @param CreatesKeyValuePair $createsKeyValuePair
     */
    public function __construct(CanCreateBooking $canCreateBooking, CreatesKeyValuePair $createsKeyValuePair)
    {
        // $this->canCreateBooking = $canCreateBooking;
        $this->createsKeyValuePair = $createsKeyValuePair;
    }


    /**
     * @param Request $request
     * @return JsonResponse
     * @throws \App\Classes\Exceptions\AccessForbiddenException
     * @throws \App\Classes\Exceptions\MalformedRequestException
     * @throws \App\Classes\Exceptions\RequestValidationException
     */
    public function logic(Request $request) : JsonResponse
    {
        // cief todo: 110 - CanCreateLock

        // $password = $request->input('password');
        // if($password !== 'prototype'){
        //     throw new AccessForbiddenException('Incorrect Password');
        // }

        $keyValuePairObject = new KeyValuePairObject(
            KVPKey::UI_SUPPLIER_PAID_CURRENCY_ORDER_TAB_IS_LOCKED,
            0
        );
        $this->createsKeyValuePair->execute(null, $keyValuePairObject);
        return $this->response([]);
    }
}
