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

#ifndef LS_STD_XML_READER_HPP
#define LS_STD_XML_READER_HPP

#include "XmlDocument.hpp"
#include "XmlParseMode.hpp"
#include "XmlParseParameter.hpp"
#include <list>
#include <ls-std/core/Class.hpp>
#include <ls-std/core/interface/IReader.hpp>
#include <ls-std/io/File.hpp>
#include <ls-std/os/dynamic-goal.hpp>

/*
 * @doc: class(name: 'XmlReader', package: 'io')
 * @doc: io.XmlReader.description('This class reads an XML file and returns an XML document.')
 * */

namespace ls::standard::io
{
  class LS_STD_DYNAMIC_GOAL XmlReader : public ls::standard::core::Class, public ls::standard::core::interface_type::IReader
  {
    public:

      explicit XmlReader(const ::std::shared_ptr<ls::standard::io::XmlDocument> &_document, const ::std::string &_absolutePath);
      ~XmlReader() noexcept override;

      // implementation

      ls::standard::core::type::byte_field read() override; // nodiscard is optional here

      // additional functionality

      [[nodiscard]] ::std::shared_ptr<ls::standard::io::XmlDocument> getDocument() const;
      void setDocument(const ::std::shared_ptr<ls::standard::io::XmlDocument> &_document);
      void setFile(const ls::standard::io::File &_xmlFile);

    private:

      ::std::shared_ptr<ls::standard::io::XmlDocument> document{};
      ls::standard::io::File xmlFile = ls::standard::io::File{""};

      void _assignDocument(const ::std::shared_ptr<ls::standard::io::XmlDocument> &_document);
      void _assignFile(const ls::standard::io::File &_xmlFile);
  };
}

#endif
