from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Union
from datetime import datetime
import dataclasses

@dataclass
class PortalsAuthSsoTenantsCreateOutputCounts:
    connections: float
@dataclass
class PortalsAuthSsoTenantsCreateOutput:
    object: str
    id: str
    name: str
    status: str
    client_id: str
    counts: PortalsAuthSsoTenantsCreateOutputCounts
    created_at: datetime
    updated_at: datetime


class mapPortalsAuthSsoTenantsCreateOutputCounts:
    @staticmethod
    def from_dict(data: Dict[str, Any]) -> PortalsAuthSsoTenantsCreateOutputCounts:
        return PortalsAuthSsoTenantsCreateOutputCounts(
        connections=data.get('connections')
        )

    @staticmethod
    def to_dict(value: Union[PortalsAuthSsoTenantsCreateOutputCounts, Dict[str, Any], None]) -> Optional[Dict[str, Any]]:
        if value is None:
            return None
        if isinstance(value, dict):
            return value
        return dataclasses.asdict(value)

class mapPortalsAuthSsoTenantsCreateOutput:
    @staticmethod
    def from_dict(data: Dict[str, Any]) -> PortalsAuthSsoTenantsCreateOutput:
        return PortalsAuthSsoTenantsCreateOutput(
        object=data.get('object'),
        id=data.get('id'),
        name=data.get('name'),
        status=data.get('status'),
        client_id=data.get('client_id'),
        counts=mapPortalsAuthSsoTenantsCreateOutputCounts.from_dict(data.get('counts')) if data.get('counts') else None,
        created_at=datetime.fromisoformat(data.get('created_at').replace('Z', '+00:00')) if data.get('created_at') else None,
        updated_at=datetime.fromisoformat(data.get('updated_at').replace('Z', '+00:00')) if data.get('updated_at') else None
        )

    @staticmethod
    def to_dict(value: Union[PortalsAuthSsoTenantsCreateOutput, Dict[str, Any], None]) -> Optional[Dict[str, Any]]:
        if value is None:
            return None
        if isinstance(value, dict):
            return value
        # assume dataclass for generated models
        return dataclasses.asdict(value)

@dataclass
class PortalsAuthSsoTenantsCreateBody:
    name: str


class mapPortalsAuthSsoTenantsCreateBody:
    @staticmethod
    def from_dict(data: Dict[str, Any]) -> PortalsAuthSsoTenantsCreateBody:
        return PortalsAuthSsoTenantsCreateBody(
        name=data.get('name')
        )

    @staticmethod
    def to_dict(value: Union[PortalsAuthSsoTenantsCreateBody, Dict[str, Any], None]) -> Optional[Dict[str, Any]]:
        if value is None:
            return None
        if isinstance(value, dict):
            return value
        # assume dataclass for generated models
        return dataclasses.asdict(value)

