
{# Jinja macro to validate package author -#}
{% macro validate_full_name(package_author) -%}
  {%- if not package_author | regex_search('^[a-zA-Z0-9_ \-]+$') %}
    {{ package_author }} is not a valid package author.
  {%- endif %}
{%- endmacro %}

{# Jinja macro to validate package author email -#}
{% macro validate_email(package_author_email) -%}
  {%- if not package_author_email | regex_search('^[\w\.-]+@[\w\.-]+\.\w+$') %}
    {{ package_author_email }} is not a valid package author email.
  {%- endif %}
{%- endmacro %}

{# Jinja macro to validate project name -#}
{% macro validate_project_name(project_name) -%}
  {%- if not project_name | regex_search('^[a-zA-Z0-9_ \-]+$') %}
    {{ project_name }} is not a valid project name.
  {%- endif %}
{%- endmacro %}

{# Jinja macro to validate package slug -#}
{% macro validate_slug(package_slug) -%}
  {%- if not package_slug | regex_search('^[a-z0-9_\-]+$') %}
    {{ package_slug }} is not a valid package slug.
  {%- endif %}
{%- endmacro %}

{% macro validate_github_username(github_username) -%}
  {%- if not github_username | regex_search('^[a-zA-Z0-9_\-]+$') %}
    {{ github_username }} is not a valid github username.
  {%- endif %}
{%- endmacro %}

{% macro validate_additional_authors(additional_authors) -%}
    {%- if additional_authors and not additional_authors | regex_search('^[a-zA-Z0-9_ \-]+(,\s*[a-zA-Z0-9_ \-]+)*$') %}
        Additional authors must be comma-separated names with alphanumeric characters, spaces, underscores, or hyphens.
    {%- endif %}
{%- endmacro %}
