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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .dashboard_write_type import DashboardWriteType
from .json_node_write import JsonNodeWrite


class DashboardWrite(UniversalBaseModel):
    project_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Project ID. Takes precedence over project_name when both are provided.
    """

    project_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    For project scope, specify either project_id or project_name. If project_name is provided and the project does not exist, it will be created. Ignored when project_id is provided. If neither is provided, the dashboard is created at workspace level.
    """

    name: str
    type: typing.Optional[DashboardWriteType] = None
    description: typing.Optional[str] = None
    config: JsonNodeWrite

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
