<?php

declare(strict_types=1);

namespace App\Framework\Serializer\Json;

/**
 * Configuration for JSON serializer
 *
 * This class encapsulates the configuration options for the JSON serializer.
 */
final readonly class JsonSerializerConfig
{
    /**
     * Constructor
     *
     * @param int $flags JSON encoding flags
     * @param int $depth Maximum depth for encoding/decoding
     */
    public function __construct(
        public int $flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE,
        public int $depth = 512
    ) {
    }

    /**
     * Creates a config with compact formatting (no pretty printing)
     *
     * @return self
     */
    public static function compact(): self
    {
        return new self(JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
    }

    /**
     * Creates a config with pretty printing enabled
     *
     * @return self
     */
    public static function pretty(): self
    {
        return new self(JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
    }

    /**
     * Creates a config with minimal options (no special flags)
     *
     * @return self
     */
    public static function minimal(): self
    {
        return new self(0);
    }
}
