<?php

namespace NoahVet\Reef\Domain\Serialization\Json;

use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;

interface JsonSerializerFacadeInterface
{
    /**
     * @param list<DenormalizerInterface|NormalizerInterface> $normalizers
     * @param array<string, mixed>                            $context
     *
     * @return array<mixed>|string|int|float|bool|\ArrayObject<string, mixed>|null
     */
    public function normalize(
        mixed $data,
        array $normalizers = [],
        array $context = [],
    ): array|string|int|float|bool|\ArrayObject|null;

    /**
     * @template T of object
     *
     * @param class-string<T>                                 $type
     * @param list<DenormalizerInterface|NormalizerInterface> $normalizers
     *
     * @return T
     */
    public function deserialize(
        string $data,
        string $type,
        array $normalizers = [],
    ): object;

    /**
     * @template T of object
     *
     * @param array<string, mixed>                            $data
     * @param class-string<T>                                 $type
     * @param list<DenormalizerInterface|NormalizerInterface> $normalizers
     * @param array<string, mixed>                            $context
     * @param list<string>                                    $ignoredAttributes
     *
     * @return T
     */
    public function denormalize(
        array $data,
        string $type,
        array $normalizers = [],
        array $context = [],
        array $ignoredAttributes = [],
        ?object $objectToPopulate = null,
    ): object;
}
