<?php

declare(strict_types=1);

namespace App\Domain\SmartLink\Exceptions;

use App\Domain\SmartLink\ValueObjects\ShortCode;
use App\Domain\SmartLink\ValueObjects\SmartLinkId;
use App\Framework\Exception\ErrorCode;
use App\Framework\Exception\FrameworkException;

final class SmartLinkNotFoundException extends FrameworkException
{
    public static function forId(SmartLinkId $id): self
    {
        return self::create(
            ErrorCode::ENTITY_NOT_FOUND,
            sprintf('SmartLink with ID "%s" not found', $id->toString())
        )->withData(['link_id' => $id->toString()]);
    }

    public static function forShortCode(ShortCode $shortCode): self
    {
        return self::create(
            ErrorCode::ENTITY_NOT_FOUND,
            sprintf('SmartLink with code "%s" not found', $shortCode->toString())
        )->withData(['short_code' => $shortCode->toString()]);
    }
}
