<?php

namespace App\Support;

use Carbon\CarbonImmutable;

class ClinicTime
{
    /** Parse a clinic-local datetime string into UTC. */
    public static function toUtc(string $local): CarbonImmutable
    {
        $tz = app(Tenancy::class)->get()?->timezone ?? config('app.timezone');

        return CarbonImmutable::parse($local, $tz)->utc();
    }

    public static function timezone(): string
    {
        return app(Tenancy::class)->get()?->timezone ?? config('app.timezone');
    }
}
