<?php

namespace App\Support;

final class LadillAppUrl
{
    public static function connect(string $appSubdomain, string $path = '/'): string
    {
        $root = (string) config('app.platform_domain', 'ladill.com');
        $path = '/'.ltrim($path, '/');
        $target = "https://{$appSubdomain}.{$root}{$path}";

        return "https://{$appSubdomain}.{$root}/sso/connect?redirect=".urlencode($target);
    }
}
