<?php

namespace DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Service\Validator;

use DropshippingExportFreeVendor\WPDesk\Library\DropshippingExport\Service\Locator\FileLocatorService;
use InvalidArgumentException;
/**
 * Class ConverterValidatorService, validator for converter service.
 *
 * @package WPDesk\Library\DropshippingExport\Service\Validator
 */
class ConverterValidatorService
{
    private $file_locator;
    public function __construct(FileLocatorService $file_locator)
    {
        $this->file_locator = $file_locator;
    }
    public function is_save_path_valid(string $save_location): bool
    {
        if (!$this->file_locator->check_if_dir_exists($save_location)) {
            throw new InvalidArgumentException('Error, file destination directory not exists.');
        }
        if ($this->file_locator->check_if_file_is_dir($save_location)) {
            throw new InvalidArgumentException('Error, convert destination must be the file - dir is used.');
        }
        return \true;
    }
}
