# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# pylint: disable=too-many-lines
# pylint: disable=too-many-statements
from azure.cli.core.commands.parameters import (
    tags_type,
    get_three_state_flag,
    get_enum_type,
    resource_group_name_type,
    get_location_type
)
from azext_network_manager.action import (
    AddNetworkManagerScopes,
    AddConnectivityconfigurationsAppliesToGroups,
    AddGroupMembers,
    AddSource,
    AddDestination
)


def load_arguments(self, _):

    # # region network manager
    with self.argument_context('network manager') as c:
        c.argument('resource_group_name', resource_group_name_type)
        c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str,
                   help='The name of the network manager.', id_part='name')

    with self.argument_context('network manager create') as c:
        c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str,
                   help='The name of the network manager.')
        c.argument('id_', options_list=['--id'], type=str, help='Resource ID.')
        c.argument('location', arg_type=get_location_type(self.cli_ctx))
        c.argument('tags', tags_type)
        c.argument('description', type=str, help='A description of the network manager.')
        c.argument('network_manager_scopes', action=AddNetworkManagerScopes, nargs='+', help='Scope of Network '
                   'Manager.')
        c.argument('network_manager_scope_accesses', options_list=['--scope-accesses'], nargs='+', help='Scope Access. Available value: SecurityAdmin, '
                   'Connectivity.')

    with self.argument_context('network manager update') as c:
        c.argument('network_manager_name', options_list=['--name', '-n', '--network-manager-name'], type=str,
                   help='The name of the network manager.', id_part='name')
        c.argument('id_', options_list=['--id'], type=str, help='Resource ID.')
        c.argument('location', arg_type=get_location_type(self.cli_ctx))
        c.argument('tags', tags_type)
        c.argument('description', type=str, help='A description of the network manager.')
        c.argument('network_manager_scopes', action=AddNetworkManagerScopes, nargs='+', help='Scope of Network '
                   'Manager.')
        c.argument('network_manager_scope_accesses', options_list=['--scope-accesses'], nargs='+', help='Scope Access. Available value: SecurityAdmin, '
                   'Connectivity.')
        c.ignore('parameters')

    with self.argument_context('network manager connect-config create') as c:
        c.argument('resource_group_name', resource_group_name_type)
        c.argument('network_manager_name', type=str, help='The name of the network manager.')
        c.argument('configuration_name', type=str, help='The name of the network manager connectivity configuration.')
        c.argument('description', type=str, help='A description of the connectivity configuration.')
        c.argument('connectivity_topology', arg_type=get_enum_type(['HubAndSpoke', 'Mesh']),
                   help='Connectivity topology type.')
        c.argument('is_global', arg_type=get_three_state_flag(), help='Flag if global mesh is supported.')
        c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups '
                   'for configuration')
        c.argument('hub', action=AddGroupMembers, nargs='+', help='The hub vnets.')
        c.argument('delete_existing_peering', arg_type=get_three_state_flag(), help='Flag if need to remove current '
                   'existing peerings.')

    with self.argument_context('network manager connect-config update') as c:
        c.argument('resource_group_name', resource_group_name_type)
        c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name')
        c.argument('configuration_name', type=str, help='The name of the network manager connectivity configuration.',
                   id_part='child_name_1')
        c.argument('description', type=str, help='A description of the connectivity configuration.')
        c.argument('connectivity_topology', arg_type=get_enum_type(['HubAndSpoke', 'Mesh']),
                   help='Connectivity topology type.')
        c.argument('is_global', arg_type=get_three_state_flag(), help='Flag if global mesh is supported.')
        c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups '
                   'for configuration')
        c.argument('hub', action=AddGroupMembers, nargs='+', help='The hub vnets.')
        c.argument('delete_existing_peering', arg_type=get_three_state_flag(), help='Flag if need to remove current '
                   'existing peerings.')
        c.ignore('connectivity_configuration')

    with self.argument_context('network manager security-admin-config rule-collection create') as c:
        c.argument('resource_group_name', resource_group_name_type)
        c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name')
        c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.',
                   id_part='child_name_1')
        c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.')
        c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.')
        c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups '
                   'for configuration')

    with self.argument_context('network manager security-admin-config rule-collection update') as c:
        c.argument('resource_group_name', resource_group_name_type)
        c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name')
        c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.',
                   id_part='child_name_1')
        c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.')
        c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.')
        c.argument('applies_to_groups', action=AddConnectivityconfigurationsAppliesToGroups, nargs='+', help='Groups '
                   'for configuration')

    with self.argument_context('network manager security-admin-config rule-collection rule') as c:
        c.argument('resource_group_name', resource_group_name_type)
        c.argument('network_manager_name', type=str, help='The name of the network manager.', id_part='name')
        c.argument('configuration_name', type=str, help='The name of the network manager security Configuration.',
                   id_part='child_name_1')
        c.argument('rule_name', type=str, help='The name of the rule.', id_part='child_name_2')
        c.argument('rule_collection_name', type=str, help='The name of the admin rule collection.')

    with self.argument_context('network manager security-admin-config rule-collection rule create') as c:
        c.argument('access', type=str, help='Indicates the access allowed for this particular rule.', arg_type=get_enum_type(['Allow', 'Deny', 'AlwaysAllow']))
        c.argument('flag', type=str, help='Default rule flag.')
        c.argument('kind', type=str, help='Required. Whether the rule is custom or default.Constant filled by server.', arg_type=get_enum_type(['Custom', 'Default']))
        c.argument('priority', type=int, help='The priority of the rule.')
        c.argument('sources', action=AddSource, nargs='+', help='The CIDR or source IP ranges. Address prefix type is an enum with values IPPrefix or ServiceTag')
        c.argument('destinations', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or '
                   'destination IP ranges. Address prefix type is an enum with values IPPrefix or ServiceTag')
        c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.')
        c.argument('protocol', arg_type=get_enum_type(['Tcp', 'Udp', 'Icmp', 'Esp', 'Any', 'Ah']), help='Network '
                   'protocol this rule applies to.')
        c.argument('source_port_ranges', nargs='+', help='The source port ranges.')
        c.argument('destination_port_ranges', options_list=['--dest-port-ranges'], nargs='+', help='The destination port ranges.')
        c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic '
                   'matched against the rule in inbound or outbound.')

    with self.argument_context('network manager security-admin-config rule-collection rule update') as c:
        c.argument('access', type=str, help='Indicates the access allowed for this particular rule.', arg_type=get_enum_type(['Allow', 'Deny', 'AlwaysAllow']))
        c.argument('flag', type=str, help='Default rule flag.')
        c.argument('kind', type=str, help='Required. Whether the rule is custom or default.Constant filled by server.', arg_type=get_enum_type(['Custom', 'Default']))
        c.argument('priority', type=int, help='The priority of the rule.')
        c.argument('sources', action=AddSource, nargs='+', help='The CIDR or source IP ranges. Address prefix type is an enum with values IPPrefix or ServiceTag')
        c.argument('destinations', action=AddDestination, nargs='+', help='The destination address prefixes. CIDR or '
                   'destination IP ranges. Address prefix type is an enum with values IPPrefix or ServiceTag')
        c.argument('description', type=str, help='A description for this rule. Restricted to 140 chars.')
        c.argument('protocol', arg_type=get_enum_type(['Tcp', 'Udp', 'Icmp', 'Esp', 'Any', 'Ah']), help='Network '
                   'protocol this rule applies to.')
        c.argument('source_port_ranges', nargs='+', help='The source port ranges.')
        c.argument('destination_port_ranges', options_list=['--dest-port-ranges'], nargs='+', help='The destination port ranges.')
        c.argument('direction', arg_type=get_enum_type(['Inbound', 'Outbound']), help='Indicates if the traffic '
                   'matched against the rule in inbound or outbound.')
