<?php

namespace App\Domain\System\Infrastructure\ApiPlatform\Resource;

use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use App\Domain\System\Infrastructure\ApiPlatform\State\Provider\GetSystemStatusStateProvider;

#[ApiResource(
    shortName: 'System',
    operations: [
        new Get(
            uriTemplate: '/system/status',
            provider: GetSystemStatusStateProvider::class,
        ),
    ]
)]
class GetSystemStatusResource
{
    #[ApiProperty(identifier: true)]
    public string $id = 'current';

    public int $totalMangas = 0;
    public int $monitoredMangas = 0;
    /** @var array<string, int> */
    public array $mangasByStatus = [];
    public int $totalChapters = 0;
    public int $downloadedChapters = 0;
    public int $pendingChapters = 0;
    public int $totalJobs = 0;
    public int $completedJobs = 0;
    public int $failedJobs = 0;
    public int $pendingJobs = 0;
    public int $inProgressJobs = 0;
    public int $totalJobsLast24h = 0;
    public int $completedJobsLast24h = 0;
    public int $failedJobsLast24h = 0;
    public float $successRateLast24h = 0.0;
    public int $totalJobsLast7d = 0;
    public int $completedJobsLast7d = 0;
    public int $failedJobsLast7d = 0;
    public float $successRateLast7d = 0.0;
    public string $storagePath = '';
    public int $storageTotalBytes = 0;
    public int $storageFreeBytes = 0;
    public int $storageUsedBytes = 0;
    public string $storageTotalHuman = '';
    public string $storageFreeHuman = '';
    public string $storageUsedHuman = '';
    public int $totalSources = 0;
    /** @var array<string, int> */
    public array $sourcesByHealth = [];
    public string $phpVersion = '';
    public string $generatedAt = '';
}
