<?php

namespace Database\Factories;

use App\Models\Tenant;
use App\Models\TenantAdminPushSubscription;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\TenantAdminPushSubscription>
 */
class TenantAdminPushSubscriptionFactory extends Factory
{
    protected $model = TenantAdminPushSubscription::class;

    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $endpoint = $this->faker->url();

        return [
            'tenant_id' => Tenant::factory(),
            'user_id' => User::factory(),
            'device_id' => (string) Str::uuid(),
            'endpoint' => $endpoint,
            'endpoint_hash' => hash('sha256', $endpoint),
            'public_key' => base64_encode(random_bytes(32)),
            'auth_token' => base64_encode(random_bytes(16)),
            'content_encoding' => 'aes128gcm',
            'status' => 'active',
            'language' => 'de',
            'user_agent' => 'Mozilla/5.0',
        ];
    }
}
