<?php

namespace Database\Factories;

use App\Enums\LegalDocumentType;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\LegalDocument>
 */
class LegalDocumentFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        return [
            'slug' => 'privacy-policy',
            'type' => LegalDocumentType::PRIVACY_POLICY,
            'version' => 1,
            'title' => [
                'fr' => 'Politique de confidentialité',
            ],
            'content' => [
                'fr' => [
                    'intro' => [
                        'Cette politique explique comment Bowli traite les données de l’application mobile.',
                    ],
                    'sections' => [
                        [
                            'title' => 'Données collectées',
                            'body' => [
                                'Bowli traite les données nécessaires au fonctionnement du compte et du suivi nutritionnel.',
                            ],
                        ],
                    ],
                ],
            ],
            'is_active' => true,
            'published_at' => now(),
        ];
    }

    public function terms(): static
    {
        return $this->state(fn (): array => [
            'slug' => 'terms-of-service',
            'type' => LegalDocumentType::TERMS,
            'title' => [
                'fr' => "Conditions d'utilisation",
            ],
            'content' => [
                'fr' => [
                    'intro' => [
                        'Ces conditions encadrent l’utilisation de Bowli.',
                    ],
                    'sections' => [
                        [
                            'title' => 'Compte utilisateur',
                            'body' => [
                                'Tu es responsable des informations fournies et de l’utilisation de ton compte.',
                            ],
                        ],
                    ],
                ],
            ],
        ]);
    }

    public function inactive(): static
    {
        return $this->state(fn (): array => [
            'is_active' => false,
        ]);
    }

    public function unpublished(): static
    {
        return $this->state(fn (): array => [
            'published_at' => null,
        ]);
    }
}
