{# test_plugin_template.j2 #}
{%- set test_name = plugin_name | default("sample_test",true) -%}
{%- set author = author | default("Your Name") -%}
{%- set description = description | default("A custom test plugin for Ansible.") -%}
{%- set license = license | default("GPL-3.0-or-later") -%}
# {{ test_name }}.py - {{ description }}
# Author: {{ author }}
# License: {{ license }}

from __future__ import absolute_import, annotations, division, print_function


__metaclass__ = type  # pylint: disable=C0103

from typing import TYPE_CHECKING


if TYPE_CHECKING:
    from typing import Callable


DOCUMENTATION = """
    name: {{ test_name }}
    author: {{ author }}
    version_added: "1.0.0"
    short_description: {{ description }}
    description:
      - This is a demo test plugin designed to return a bool.
    options:
      name:
        type: bool
        description: This is a sample option.
"""

EXAMPLES = """
# {{ test_name }} test example
{% raw %}
- name: Display a bool
  ansible.builtin.debug:
    msg: "{{ 50 {%- endraw %} | {{ test_name }} }}"
"""


def _sample_test(val: int) -> bool:
    """Returns a bool.

    Args:
        val: The value to test.

    Returns:
        bool: The result.
    """
    return val > 42


class TestModule:
    """test plugin."""

    def tests(self) -> dict[str, Callable[[int], bool]]:
        """Map test plugin names to their functions.

        Returns:
            dict: The test plugin functions.
        """
        return {"{{ test_name }}": _sample_test}
