<?php

namespace App\Services;

use App\Models\Order;

class InvoiceLinkService
{
    public function __construct(
        protected InvoiceTokenService $invoiceTokenService
    ) {
    }

    public function secureUrl(Order $order): string
    {
        $token = $this->invoiceTokenService->encryptOrderId($order->id);

        return route('invoice.show', ['encrypted_order_id' => $token], absolute: true);
    }

    public function shortUrlForSms(Order $order): string
    {
        $secureUrl = $this->secureUrl($order);
        $shortUrl = kiyoshorturl($secureUrl);

        return $shortUrl;
    }
}
