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

#include <ls-std/core/evaluator/EmptyStringArgumentEvaluator.hpp>
#include <ls-std/io/xml/XmlAttribute.hpp>

using ls::standard::core::Class;
using ls::standard::core::EmptyStringArgumentEvaluator;
using ls::standard::io::XmlAttribute;
using std::string;

XmlAttribute::XmlAttribute(const string &_name) : Class("XmlAttribute")
{
  this->_assignName(_name);
}

XmlAttribute::~XmlAttribute() noexcept = default;

string XmlAttribute::getName() const
{
  return this->name;
}

string XmlAttribute::getValue() const
{
  return this->value;
}

void XmlAttribute::setName(const string &_name)
{
  this->_assignName(_name);
}

void XmlAttribute::setValue(const string &_value)
{
  this->_assignValue(_value);
}

string XmlAttribute::toXml() const
{
  return this->name + "=\"" + this->value + "\"";
}

void XmlAttribute::_assignName(const string &_name)
{
  EmptyStringArgumentEvaluator{_name, "xml attribute name is empty!"}.evaluate();
  this->name = _name;
}

void XmlAttribute::_assignValue(const string &_value)
{
  EmptyStringArgumentEvaluator{_value, "xml attribute value is empty!"}.evaluate();
  this->value = _value;
}
