<?php

declare(strict_types=1);

namespace Database\Factories;

use App\Domain\Account\Models\Account;
use App\Domain\Snapshot\Models\AccountSnapshot;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

class AccountSnapshotFactory extends Factory
{
    protected $model = AccountSnapshot::class;

    public function definition(): array
    {
        static $counter = 1;
        $year = now()->format('Y');
        $num = str_pad((string) $counter++, 6, '0', STR_PAD_LEFT);

        return [
            'snapshot_number' => "SNAP-{$year}-{$num}",
            'account_id' => Account::factory(),
            'type' => 'manual_snapshot',
            'source' => 'created',
            'status' => 'completed',
            'file_path' => '/var/backups/onox/snapshots/test.tar.gz',
            'size_bytes' => $this->faker->numberBetween(10_000_000, 500_000_000),
            'includes_files' => true,
            'includes_databases' => true,
            'includes_dns' => true,
            'includes_email' => true,
            'includes_config' => false,
            'includes_ssl' => false,
            'includes_cron' => true,
            'completed_at' => now(),
            'duration_seconds' => $this->faker->numberBetween(30, 300),
            'expires_at' => now()->addDays(30),
            'created_by_user_id' => User::factory(),
        ];
    }
}
