<?php

declare(strict_types=1);

namespace Gls\GlsPoland\Consignment\Exception;

final class ConsignmentAlreadyPickedUpException extends \RuntimeException
{
    private $consignmentId;
    private $pickupId;

    public function __construct(int $consignmentId, int $pickupId, string $message = '')
    {
        parent::__construct($message);
        $this->consignmentId = $consignmentId;
        $this->pickupId = $pickupId;
    }

    public static function create(int $consignmentId, int $pickupId): self
    {
        return new self(
            $consignmentId,
            $pickupId,
            sprintf('Consignment with ID %d cannot be deleted because it belongs to pickup %d.', $consignmentId, $pickupId)
        );
    }

    public function getConsignmentId(): int
    {
        return $this->consignmentId;
    }

    public function getPickupId(): int
    {
        return $this->pickupId;
    }
}
