# coding=utf-8
# --------------------------------------------------------------------------
# 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.
# --------------------------------------------------------------------------

from typing import Any, Optional, TYPE_CHECKING

from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer

if TYPE_CHECKING:
    # pylint: disable=unused-import,ungrouped-imports
    from azure.core.credentials_async import AsyncTokenCredential

from ._configuration import PlannerConfiguration
from .operations import GroupsOperations
from .operations import GroupsPlannerOperations
from .operations import GroupsPlannerPlansOperations
from .operations import GroupsPlannerPlansBucketsOperations
from .operations import GroupsPlannerPlansBucketsTasksOperations
from .operations import GroupsPlannerPlansTasksOperations
from .operations import PlannerPlannerOperations
from .operations import PlannerOperations
from .operations import PlannerBucketsOperations
from .operations import PlannerBucketsTasksOperations
from .operations import PlannerPlansOperations
from .operations import PlannerPlansBucketsOperations
from .operations import PlannerPlansBucketsTasksOperations
from .operations import PlannerPlansTasksOperations
from .operations import PlannerTasksOperations
from .operations import UsersOperations
from .operations import UsersPlannerOperations
from .operations import UsersPlannerPlansOperations
from .operations import UsersPlannerPlansBucketsOperations
from .operations import UsersPlannerPlansBucketsTasksOperations
from .operations import UsersPlannerPlansTasksOperations
from .operations import UsersPlannerTasksOperations
from .. import models


class Planner(object):
    """Planner.

    :ivar groups: GroupsOperations operations
    :vartype groups: planner.aio.operations.GroupsOperations
    :ivar groups_planner: GroupsPlannerOperations operations
    :vartype groups_planner: planner.aio.operations.GroupsPlannerOperations
    :ivar groups_planner_plans: GroupsPlannerPlansOperations operations
    :vartype groups_planner_plans: planner.aio.operations.GroupsPlannerPlansOperations
    :ivar groups_planner_plans_buckets: GroupsPlannerPlansBucketsOperations operations
    :vartype groups_planner_plans_buckets: planner.aio.operations.GroupsPlannerPlansBucketsOperations
    :ivar groups_planner_plans_buckets_tasks: GroupsPlannerPlansBucketsTasksOperations operations
    :vartype groups_planner_plans_buckets_tasks: planner.aio.operations.GroupsPlannerPlansBucketsTasksOperations
    :ivar groups_planner_plans_tasks: GroupsPlannerPlansTasksOperations operations
    :vartype groups_planner_plans_tasks: planner.aio.operations.GroupsPlannerPlansTasksOperations
    :ivar planner_planner: PlannerPlannerOperations operations
    :vartype planner_planner: planner.aio.operations.PlannerPlannerOperations
    :ivar planner: PlannerOperations operations
    :vartype planner: planner.aio.operations.PlannerOperations
    :ivar planner_buckets: PlannerBucketsOperations operations
    :vartype planner_buckets: planner.aio.operations.PlannerBucketsOperations
    :ivar planner_buckets_tasks: PlannerBucketsTasksOperations operations
    :vartype planner_buckets_tasks: planner.aio.operations.PlannerBucketsTasksOperations
    :ivar planner_plans: PlannerPlansOperations operations
    :vartype planner_plans: planner.aio.operations.PlannerPlansOperations
    :ivar planner_plans_buckets: PlannerPlansBucketsOperations operations
    :vartype planner_plans_buckets: planner.aio.operations.PlannerPlansBucketsOperations
    :ivar planner_plans_buckets_tasks: PlannerPlansBucketsTasksOperations operations
    :vartype planner_plans_buckets_tasks: planner.aio.operations.PlannerPlansBucketsTasksOperations
    :ivar planner_plans_tasks: PlannerPlansTasksOperations operations
    :vartype planner_plans_tasks: planner.aio.operations.PlannerPlansTasksOperations
    :ivar planner_tasks: PlannerTasksOperations operations
    :vartype planner_tasks: planner.aio.operations.PlannerTasksOperations
    :ivar users: UsersOperations operations
    :vartype users: planner.aio.operations.UsersOperations
    :ivar users_planner: UsersPlannerOperations operations
    :vartype users_planner: planner.aio.operations.UsersPlannerOperations
    :ivar users_planner_plans: UsersPlannerPlansOperations operations
    :vartype users_planner_plans: planner.aio.operations.UsersPlannerPlansOperations
    :ivar users_planner_plans_buckets: UsersPlannerPlansBucketsOperations operations
    :vartype users_planner_plans_buckets: planner.aio.operations.UsersPlannerPlansBucketsOperations
    :ivar users_planner_plans_buckets_tasks: UsersPlannerPlansBucketsTasksOperations operations
    :vartype users_planner_plans_buckets_tasks: planner.aio.operations.UsersPlannerPlansBucketsTasksOperations
    :ivar users_planner_plans_tasks: UsersPlannerPlansTasksOperations operations
    :vartype users_planner_plans_tasks: planner.aio.operations.UsersPlannerPlansTasksOperations
    :ivar users_planner_tasks: UsersPlannerTasksOperations operations
    :vartype users_planner_tasks: planner.aio.operations.UsersPlannerTasksOperations
    :param credential: Credential needed for the client to connect to Azure.
    :type credential: ~azure.core.credentials_async.AsyncTokenCredential
    :param top: Show only the first n items.
    :type top: int
    :param skip: Skip the first n items.
    :type skip: int
    :param search: Search items by search phrases.
    :type search: str
    :param filter: Filter items by property values.
    :type filter: str
    :param count: Include count of items.
    :type count: bool
    :param str base_url: Service URL
    """

    def __init__(
        self,
        credential: "AsyncTokenCredential",
        top: Optional[int] = None,
        skip: Optional[int] = None,
        search: Optional[str] = None,
        filter: Optional[str] = None,
        count: Optional[bool] = None,
        base_url: Optional[str] = None,
        **kwargs: Any
    ) -> None:
        if not base_url:
            base_url = 'https://graph.microsoft.com/beta'
        self._config = PlannerConfiguration(credential, top, skip, search, filter, count, **kwargs)
        self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

        client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
        self._serialize = Serializer(client_models)
        self._serialize.client_side_validation = False
        self._deserialize = Deserializer(client_models)

        self.groups = GroupsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.groups_planner = GroupsPlannerOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.groups_planner_plans = GroupsPlannerPlansOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.groups_planner_plans_buckets = GroupsPlannerPlansBucketsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.groups_planner_plans_buckets_tasks = GroupsPlannerPlansBucketsTasksOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.groups_planner_plans_tasks = GroupsPlannerPlansTasksOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.planner_planner = PlannerPlannerOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.planner = PlannerOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.planner_buckets = PlannerBucketsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.planner_buckets_tasks = PlannerBucketsTasksOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.planner_plans = PlannerPlansOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.planner_plans_buckets = PlannerPlansBucketsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.planner_plans_buckets_tasks = PlannerPlansBucketsTasksOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.planner_plans_tasks = PlannerPlansTasksOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.planner_tasks = PlannerTasksOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.users = UsersOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.users_planner = UsersPlannerOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.users_planner_plans = UsersPlannerPlansOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.users_planner_plans_buckets = UsersPlannerPlansBucketsOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.users_planner_plans_buckets_tasks = UsersPlannerPlansBucketsTasksOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.users_planner_plans_tasks = UsersPlannerPlansTasksOperations(
            self._client, self._config, self._serialize, self._deserialize)
        self.users_planner_tasks = UsersPlannerTasksOperations(
            self._client, self._config, self._serialize, self._deserialize)

    async def close(self) -> None:
        await self._client.close()

    async def __aenter__(self) -> "Planner":
        await self._client.__aenter__()
        return self

    async def __aexit__(self, *exc_details) -> None:
        await self._client.__aexit__(*exc_details)
