<?php

namespace Opencart\Catalog\Model\Extension\Alsendo\Module;

require_once(DIR_EXTENSION . 'alsendo/src/DTO/Entity/AlsendoShipmentStatusEntity.php');
require_once(DIR_EXTENSION . 'alsendo/src/DTO/Entity/AlsendoRegionEntity.php');

use Opencart\Extension\Alsendo\DTO\Entity\AlsendoRegionEntity;
use Opencart\Extension\Alsendo\DTO\Entity\AlsendoShipmentStatusEntity;
use Opencart\System\Engine\Model;
use Opencart\System\Engine\Registry;

class AlsendoShipmentStatus extends Model {

    public function __construct(Registry $registry) {
        parent::__construct($registry);
    }

    public function getShipmentTriggerStatusId(): ?int {
        $query = $this->db->query("SELECT `value` FROM `" . DB_PREFIX . "setting`
        WHERE `code` = 'alsendo' AND `key` = 'shipment_trigger_status_id' LIMIT 1");
        if (!$query->num_rows || $query->row['value'] === null) {
            return null;
        }
        return (int)$query->row['value'];
    }
}