/*
* 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/io/section-pair/validator/SectionPairIdentifierValidator.hpp>
#include <regex>

using ls::standard::core::Class;
using ls::standard::io::section_pair_identifier;
using ls::standard::io::SectionPairIdentifierValidator;
using std::move;
using std::regex;
using std::regex_match;
using std::string;

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

SectionPairIdentifierValidator::~SectionPairIdentifierValidator() noexcept = default;

string SectionPairIdentifierValidator::getValidationRegex()
{
  return _getValidationRegex();
}

bool SectionPairIdentifierValidator::isValid()
{
  static regex identifierRegex("^" + _getValidationRegex());
  return regex_match(this->identifier, identifierRegex);
}

string SectionPairIdentifierValidator::_getValidationRegex()
{
  return R"([a-z]([a-z0-9-]){1,63})";
}
