<?php

namespace App\Classes\Modules\Accounting\ControllersLogic;

use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use App\Http\Resources\TransactionMappingLogResource;
use App\Classes\General\Abstracts\AbstractControllerLogic;
use App\Classes\Modules\Accounting\Services\ListTransactionMappingLogs;


class HistoryImportedTransactionMappedControllerLogic extends AbstractControllerLogic
{

    /**
     * @return array
     */
    protected function notification(): array
    {
        return [
            'title' => 'Retrieved History Imported Invoices',
            'message' => 'You have successfully retrieved history imported invoices'
        ];
    }

    /** @var ListTransactionMappingLogs */
    private $listTransactionMappingLogs;

    /**
     * UpdateAnnouncementLogic constructor.
     * @param ListTransactionMappingLogs $listTransactionMappingLogs
     */
    public function __construct(
        ListTransactionMappingLogs $listTransactionMappingLogs
    ) {
        $this->listTransactionMappingLogs = $listTransactionMappingLogs;
    }

    /**
     * @param Request $request
     * @return JsonResponse
     */
    public function logic(Request $request): JsonResponse
    {
        $query = $this->listTransactionMappingLogs->execute($this->listTransactionMappingLogs->deserializeFilters($request->input('filters')));

        return $this->collectionResponse(TransactionMappingLogResource::collection($query));
    }
}
