<?php

$versionFile = base_path('VERSION');
$releaseFile = base_path('release/version.json');

$fileVersion = is_file($versionFile) ? trim((string) file_get_contents($versionFile)) : '1.0.0';
$release = is_file($releaseFile)
    ? json_decode((string) file_get_contents($releaseFile), true)
    : [];

return [
    'version' => env('APP_VERSION', $fileVersion),
    'released_at' => $release['released_at'] ?? null,
    'php' => $release['php'] ?? '^8.2',
    'laravel' => $release['laravel'] ?? '^10.10',
    'notes' => $release['notes'] ?? null,
    'latest_available' => env('APP_LATEST_VERSION', $fileVersion),
];
