# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

from ...core.datetime_utils import serialize_datetime
from ...core.pydantic_utilities import pydantic_v1
from .project_with_members import ProjectWithMembers


class GetProjectsResponse(pydantic_v1.BaseModel):
    """
    from sayari import (
        GetProjectsResponse,
        ProjectCounts,
        ProjectWithMembers,
        RoleMember,
    )

    GetProjectsResponse(
        prev="MjAyMy0xMC0yNSAxNDo0NDowNi4zMjIxMTcrMDB8VjAzTU5Z",
        next="MjAyMy0wOS0xNSAxODoyNDozOC45ODEwMjMrMDB8OFlWQjZZ",
        limit=8,
        data=[
            ProjectWithMembers(
                id="V03MNY",
                label="Project 1",
                archived=False,
                created="2023-10-25 14:44:06.322117+00",
                updated="2023-10-25 14:44:06.322117+00",
                counts=ProjectCounts(),
                members=[
                    RoleMember(
                        type="user",
                        id="auth0|7a8f3e2b91d476c5b2e04a87",
                        role="admin",
                        created="2023-10-25T14:44:06.322117+00:00",
                        updated="2023-10-25T14:44:06.322117+00:00",
                    )
                ],
            ),
            ProjectWithMembers(
                id="eYDDmY",
                label="Project 2",
                archived=False,
                created="2023-10-24 20:41:21.235451+00",
                updated="2023-10-24 20:41:21.235451+00",
                counts=ProjectCounts(
                    graph=1,
                    entity=2530,
                ),
                members=[
                    RoleMember(
                        type="user",
                        id="auth0|f0bc63a9e72d18ef4c5702d6",
                        role="admin",
                        created="2023-10-24T20:41:21.235451+00:00",
                        updated="2023-10-24T20:41:21.235451+00:00",
                    ),
                    RoleMember(
                        type="group",
                        id="org_VdFgkL2qNpweRZAs",
                        role="viewer",
                        created="2023-11-04T18:40:30.942863+00:00",
                        updated="2023-11-04T18:40:30.942863+00:00",
                    ),
                ],
            ),
        ],
    )
    """

    next: typing.Optional[str] = None
    prev: typing.Optional[str] = None
    first: typing.Optional[bool] = None
    last: typing.Optional[bool] = None
    limit: int
    data: typing.List[ProjectWithMembers]

    def json(self, **kwargs: typing.Any) -> str:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().json(**kwargs_with_defaults)

    def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().dict(**kwargs_with_defaults)

    class Config:
        frozen = True
        smart_union = True
        extra = pydantic_v1.Extra.allow
        json_encoders = {dt.datetime: serialize_datetime}
