# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Felix Fontein
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

from __future__ import absolute_import, division, print_function

__metaclass__ = type


class ModuleDocFragment(object):

    # Standard files documentation fragment
    DOCUMENTATION = r"""
options:
  hetzner_token:
    description:
      - The token for the classic Hetzner DNS API.
      - If not provided, will be read from the environment variable E(HETZNER_DNS_TOKEN).
      - Exactly one of O(hetzner_token) and O(hetzner_api_token) must be provided.
    aliases:
      - api_token
    type: str
  hetzner_api_token:
    description:
      - The token for the new Hetzner DNS API.
      - If not provided, will be read from the environment variable E(HETZNER_API_TOKEN).
      - Exactly one of O(hetzner_token) and O(hetzner_api_token) must be provided.
    type: str
notes:
  - Note that not all record types are supported by both APIs.
    The old API (O(hetzner_token)) does not support V(HTTPS), V(PTR), and V(SVCB) records.
    The new API (O(hetzner_api_token)) does not support V(DANE) records.
"""

    # NOTE: This document fragment augments the above standard DOCUMENTATION document fragment
    #       by providing alternative ways to provide configuration for plugins. (The above
    #       documentation fragment is tailored for modules.)
    PLUGIN = r"""
options:
  hetzner_token:
    env:
      - name: HETZNER_DNS_TOKEN
  hetzner_api_token:
    env:
      - name: HETZNER_API_TOKEN
"""

    # NOTE: This document fragment adds additional information on records.
    RECORD_NOTES = r"""
options: {}
notes:
  - For C(CNAME) records, use absolute DNS names for values. Absolute DNS names end with
    a trailing period C(.), for example C(foo.example.com.). If you use a relative DNS name, with no
    trailing period, the value will be relative to the zone of the C(CNAME) record.
"""

    RECORD_TYPE_SEEALSO = r"""
options: {}
seealso:
  - ref: ansible_collections.community.dns.docsite.hetzner_guide.records
    description: More information on supported DNS record types.
"""

    # WARNING: This section is automatically generated by update-docs-fragments.py.
    #          It is used to augment the docs fragments module_record, module_record_set.
    #          DO NOT EDIT MANUALLY!
    RECORD_DEFAULT_TTL = r"""
options:
  ttl:
    default: null
"""

    # WARNING: This section is automatically generated by update-docs-fragments.py.
    #          It is used to augment the docs fragments module_record, module_record_info,
    #          module_record_set, module_record_set_info.
    #          DO NOT EDIT MANUALLY!
    RECORD_TYPE_CHOICES = r"""
options:
  type:
    choices:
      - A
      - AAAA
      - CAA
      - CNAME
      - DANE
      - DS
      - HINFO
      - HTTPS
      - MX
      - NS
      - PTR
      - RP
      - SOA
      - SRV
      - SVCB
      - TLSA
      - TXT
"""

    # WARNING: This section is automatically generated by update-docs-fragments.py.
    #          It is used to augment the docs fragment module_record_sets.
    #          DO NOT EDIT MANUALLY!
    RECORD_TYPE_CHOICES_RECORD_SETS_MODULE = r"""
options:
  record_sets:
    suboptions:
      record:
        description:
          - The full DNS record to create or delete.
          - Exactly one of O(record_sets[].record) and O(record_sets[].prefix) must
            be specified.
        type: str
      prefix:
        description:
          - The prefix of the DNS record.
          - This is the part of O(record_sets[].record) before O(zone_name). For example,
            if the record to be modified is C(www.example.com) for the zone C(example.com),
            the prefix is V(www). If the record in this example would be C(example.com),
            the prefix would be V('') (empty string).
          - Exactly one of O(record_sets[].record) and O(record_sets[].prefix) must
            be specified.
        type: str
      ttl:
        description:
          - The TTL to give the new record, in seconds.
        type: int
        default: null
      type:
        description:
          - The type of DNS record to create or delete.
        required: true
        type: str
        choices:
          - A
          - AAAA
          - CAA
          - CNAME
          - DANE
          - DS
          - HINFO
          - HTTPS
          - MX
          - NS
          - PTR
          - RP
          - SOA
          - SRV
          - SVCB
          - TLSA
          - TXT
      value:
        description:
          - The new value when creating a DNS record.
          - YAML lists or multiple comma-spaced values are allowed.
          - When deleting a record all values for the record must be specified or
            it will not be deleted.
          - Must be specified if O(record_sets[].ignore=false).
        type: list
        elements: str
      ignore:
        description:
          - If set to V(true), O(record_sets[].value) will be ignored.
          - This is useful when O(prune=true), but you do not want certain entries
            to be removed without having to know their current value.
        type: bool
        default: false
"""

    # WARNING: This section is automatically generated by update-docs-fragments.py.
    #          It is used to augment the docs fragment inventory_records.
    #          DO NOT EDIT MANUALLY!
    RECORD_TYPE_CHOICES_RECORDS_INVENTORY = r"""
options:
  simple_filters:
    suboptions:
      type:
        description:
          - Record types whose values to use.
        type: list
        elements: string
        default:
          - A
          - AAAA
          - CNAME
        choices:
          - A
          - AAAA
          - CAA
          - CNAME
          - DANE
          - DS
          - HINFO
          - HTTPS
          - MX
          - NS
          - PTR
          - RP
          - SOA
          - SRV
          - SVCB
          - TLSA
          - TXT
"""

    # WARNING: This section is automatically generated by update-docs-fragments.py.
    #          It is used to augment the docs fragments inventory_records, module_record,
    #          module_record_info, module_record_set, module_record_set_info,
    #          module_record_sets, module_zone_info.
    #          DO NOT EDIT MANUALLY!
    ZONE_ID_TYPE = r"""
options:
  zone_id:
    type: str
"""
