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

#include <ls-std/core/exception/IllegalArgumentException.hpp>
#include <ls-std/io/section-pair/SectionPairMessageFormatter.hpp>
#include <ls-std/io/section-pair/evaluator/SectionPairIdentifierArgumentEvaluator.hpp>
#include <ls-std/io/section-pair/validator/SectionPairIdentifierValidator.hpp>
#include <string>

using ls::standard::core::Class;
using ls::standard::core::IllegalArgumentException;
using ls::standard::io::section_pair_identifier;
using ls::standard::io::SectionPairIdentifierArgumentEvaluator;
using ls::standard::io::SectionPairIdentifierValidator;
using ls::standard::io::SectionPairMessageFormatter;
using std::move;
using std::string;

SectionPairIdentifierArgumentEvaluator::SectionPairIdentifierArgumentEvaluator(section_pair_identifier _identifier) : Class("SectionPairIdentifierArgumentEvaluator"), identifier(::move(_identifier))
{}

SectionPairIdentifierArgumentEvaluator::~SectionPairIdentifierArgumentEvaluator() noexcept = default;

void SectionPairIdentifierArgumentEvaluator::evaluate()
{
  if (!SectionPairIdentifierValidator{this->identifier}.isValid())
  {
    const string message = "\"" + this->identifier + "\" is not a valid identifier!";
    throw IllegalArgumentException{SectionPairMessageFormatter::getFormattedMessage(message)};
  }
}
