# generated by datamodel-codegen:
#   filename:  schema/tests/customMetric.json
#   timestamp: 2022-08-23T15:52:10+00:00

from __future__ import annotations

from typing import Optional

from pydantic import BaseModel, Extra, Field

from ..type import basic, entityReference


class CustomMetric(BaseModel):
    class Config:
        extra = Extra.forbid

    id: Optional[basic.Uuid] = Field(
        None, description='Unique identifier of this Custom Metric instance.'
    )
    name: basic.EntityName = Field(
        ..., description='Name that identifies this Custom Metric.'
    )
    description: Optional[basic.Markdown] = Field(
        None, description='Description of the Metric.'
    )
    columnName: str = Field(..., description='Name of the column in a table.')
    expression: str = Field(
        ...,
        description='SQL expression to compute the Metric. It should return a single numerical value.',
    )
    owner: Optional[entityReference.EntityReference] = Field(
        None, description='Owner of this Custom Metric.'
    )
    updatedAt: Optional[basic.Timestamp] = Field(
        None,
        description='Last update time corresponding to the new version of the entity in Unix epoch time milliseconds.',
    )
    updatedBy: Optional[str] = Field(None, description='User who made the update.')
