from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
try:
    groups.namespace
except:
    groups.addgroup('namespace')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
dict_env['frozen_manual.{{ identifier }}_proxy.address'] = "{{ my_identifier == 'HTTPS' and _.use_for_https }}"
dict_env['frozen_manual.{{ identifier }}_proxy.port'] = "{{ my_identifier == 'HTTPS' and _.use_for_https }}"
dict_env['frozen_manual.{{ identifier }}_proxy.version'] = "{{ my_identifier == 'HTTPS' and _.use_for_https }}"
dict_env['hidden_manual.{{ identifier }}_proxy'] = "{{ my_identifier == 'HTTPS' and _.use_for_https }}"
option_1 = ChoiceOption(name="proxy_mode", doc="Configure Proxy Access to the Internet", values=("No proxy", "Auto-detect proxy settings for this network", "Use system proxy settings", "Manual proxy configuration", "Automatic proxy configuration URL"), default="No proxy", properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tutorial_tmp/structural/firefox/00-proxy.yml'], 'type': 'choice'})
option_4 = DomainnameOption(name="address", doc="HTTP address", type="domainname", allow_ip=True, properties=frozenset({"basic", "mandatory"}), informations={'ymlfiles': ['tutorial_tmp/structural/firefox/10-manual.yml'], 'type': 'domainname'})
option_5 = PortOption(name="port", doc="HTTP Port", default="8080", allow_private=True, properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tutorial_tmp/structural/firefox/10-manual.yml'], 'type': 'port'})
optiondescription_3 = OptionDescription(name="http_proxy", doc="HTTP Proxy", children=[option_4, option_5], properties=frozenset({"basic"}), informations={'ymlfiles': ['tutorial_tmp/structural/firefox/10-manual.yml']})
option_6 = BoolOption(name="use_for_https", doc="Also use this proxy for HTTPS", default=True, properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tutorial_tmp/structural/firefox/20-manual.yml'], 'type': 'boolean'})
option_8 = DomainnameOption(name="address", doc="{{ identifier }} address", default=Calculation(func['calc_value'], Params((ParamOption(option_4)))), type="domainname", allow_ip=True, properties=frozenset({"force_default_on_freeze", "mandatory", "standard", Calculation(func['jinja_to_property'], Params((ParamValue("frozen"), ParamValue("in HTTPS case if \"_.use_for_https\" is set to \"true\"")), kwargs={'__internal_jinja': ParamValue("frozen_manual.{{ identifier }}_proxy.address"), '__internal_type': ParamValue("boolean"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tutorial_tmp/structural/firefox/20-manual.yml']), '__internal_attribute': ParamValue("frozen"), '__internal_variable': ParamValue("manual.{{ identifier }}_proxy.address"), 'my_identifier': ParamIdentifier(), 'when': ParamValue(True), 'inverse': ParamValue(False), '_.use_for_https': ParamOption(option_6, notraisepropertyerror=True)}), help_function=func['jinja_to_property_help'])}), informations={'ymlfiles': ['tutorial_tmp/structural/firefox/20-manual.yml'], 'type': 'domainname'})
option_9 = PortOption(name="port", doc="{{ identifier }} port", default=Calculation(func['calc_value'], Params((ParamOption(option_5)))), allow_private=True, properties=frozenset({"force_default_on_freeze", "mandatory", "standard", Calculation(func['jinja_to_property'], Params((ParamValue("frozen"), ParamValue("in HTTPS case if \"_.use_for_https\" is set to \"true\"")), kwargs={'__internal_jinja': ParamValue("frozen_manual.{{ identifier }}_proxy.port"), '__internal_type': ParamValue("boolean"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tutorial_tmp/structural/firefox/20-manual.yml']), '__internal_attribute': ParamValue("frozen"), '__internal_variable': ParamValue("manual.{{ identifier }}_proxy.port"), 'my_identifier': ParamIdentifier(), 'when': ParamValue(True), 'inverse': ParamValue(False), '_.use_for_https': ParamOption(option_6, notraisepropertyerror=True)}), help_function=func['jinja_to_property_help'])}), informations={'ymlfiles': ['tutorial_tmp/structural/firefox/20-manual.yml'], 'type': 'port'})
option_10 = ChoiceOption(name="version", doc="SOCKS host version used by proxy", values=("v4", "v5"), default="v5", properties=frozenset({"force_default_on_freeze", "mandatory", "standard", Calculation(func['variable_to_property'], Params((), kwargs={'prop': ParamValue("disabled"), 'value': ParamIdentifier(), 'when': ParamValue("HTTPS"), 'inverse': ParamValue(False)}), help_function=func['variable_to_property']), Calculation(func['jinja_to_property'], Params((ParamValue("frozen"), ParamValue("in HTTPS case if \"_.use_for_https\" is set to \"true\"")), kwargs={'__internal_jinja': ParamValue("frozen_manual.{{ identifier }}_proxy.version"), '__internal_type': ParamValue("boolean"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tutorial_tmp/structural/firefox/20-manual.yml']), '__internal_attribute': ParamValue("frozen"), '__internal_variable': ParamValue("manual.{{ identifier }}_proxy.version"), 'my_identifier': ParamIdentifier(), 'when': ParamValue(True), 'inverse': ParamValue(False), '_.use_for_https': ParamOption(option_6, notraisepropertyerror=True)}), help_function=func['jinja_to_property_help'])}), informations={'ymlfiles': ['tutorial_tmp/structural/firefox/20-manual.yml'], 'type': 'choice'})
optiondescription_7 = ConvertDynOptionDescription(name="{{ identifier }}_proxy", doc="{{ identifier }} Proxy", identifiers=["HTTPS", "SOCKS"], children=[option_8, option_9, option_10], properties=frozenset({"standard", Calculation(func['jinja_to_property'], Params((ParamValue("hidden"), ParamValue("in HTTPS case if \"_.use_for_https\" is set to \"true\"")), kwargs={'__internal_jinja': ParamValue("hidden_manual.{{ identifier }}_proxy"), '__internal_type': ParamValue("boolean"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tutorial_tmp/structural/firefox/20-manual.yml']), '__internal_attribute': ParamValue("hidden"), '__internal_variable': ParamValue("manual.{{ identifier }}_proxy"), 'my_identifier': ParamIdentifier(), 'when': ParamValue(True), 'inverse': ParamValue(False), '_.use_for_https': ParamOption(option_6, notraisepropertyerror=True)}), help_function=func['jinja_to_property_help'])}), informations={'ymlfiles': ['tutorial_tmp/structural/firefox/20-manual.yml']})
optiondescription_2 = OptionDescription(name="manual", doc="Manual proxy configuration", children=[optiondescription_3, option_6, optiondescription_7], properties=frozenset({"basic", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_1), 'prop': ParamValue("disabled"), 'when': ParamValue("Manual proxy configuration"), 'inverse': ParamValue(True)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['tutorial_tmp/structural/firefox/10-manual.yml', 'tutorial_tmp/structural/firefox/20-manual.yml']})
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, optiondescription_2])
