/*
* Author:          Patrick-Christopher Mattulat
* Co-Author:       Claude Sonnet 4.6 (LLM)
* Company:         Lynar Studios
* E-Mail:          webmaster@lynarstudios.com
* Created:         2023-02-11
* Changed:         2026-06-23
*
* */

#ifndef LS_STD_SERIALIZABLE_SECTION_PAIR_ROW_HPP
#define LS_STD_SERIALIZABLE_SECTION_PAIR_ROW_HPP

#include "SerializableSectionPairParameter.hpp"
#include <ls-std/core/Class.hpp>
#include <ls-std/core/interface/ISerializable.hpp>
#include <ls-std/os/dynamic-goal.hpp>
#include <memory>
#include <string>

/*
 * @doc: class(name: 'SerializableSectionPairRow', package: 'io')
 * @doc: io.SerializableSectionPairRow.description('This class can serialize a Section Pair row for file persistence.')
 * */

namespace ls::standard::io
{
  class LS_STD_DYNAMIC_GOAL SerializableSectionPairRow : public ls::standard::core::interface_type::ISerializable, public ls::standard::core::Class
  {
    public:

      explicit SerializableSectionPairRow(const ls::standard::io::SerializableSectionPairParameter &_parameter);
      ~SerializableSectionPairRow() noexcept override;

      [[nodiscard]] ::std::shared_ptr<ls::standard::core::Class> getValue() const;
      [[nodiscard]] ls::standard::core::type::byte_field marshal() override;
      void unmarshal(const ls::standard::core::type::byte_field &_data) override;

    private:

      ls::standard::io::SerializableSectionPairParameter parameter{};

      [[nodiscard]] ::std::string _marshalKey() const;
      void _unmarshalListValue(const ls::standard::core::type::byte_field &_data) const;
      void _unmarshalSingleValue(const ls::standard::core::type::byte_field &_data) const;
  };
}

#endif
