<?php

declare(strict_types=1);

namespace Database\Factories;

use App\Models\StoredReport;
use App\Models\Tenant;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends Factory<StoredReport>
 */
class StoredReportFactory extends Factory
{
    protected $model = StoredReport::class;

    /**
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'tenant_id' => Tenant::factory(),
            'report_type' => StoredReport::REPORT_TYPE_PERMISSION_POSTURE,
            'payload' => [
                'posture_score' => 86,
                'required_count' => 14,
                'granted_count' => 12,
                'checked_at' => now()->toIso8601String(),
                'permissions' => [
                    [
                        'key' => 'DeviceManagementConfiguration.ReadWrite.All',
                        'type' => 'application',
                        'status' => 'granted',
                        'features' => ['policy-sync', 'backup', 'restore'],
                    ],
                    [
                        'key' => 'DeviceManagementApps.ReadWrite.All',
                        'type' => 'application',
                        'status' => 'missing',
                        'features' => ['policy-sync', 'backup'],
                    ],
                ],
            ],
        ];
    }
}
