# generated by datamodel-codegen:
#   filename:  api/tests/createCustomMetric.json
#   timestamp: 2022-10-04T14:49:18+00:00

from __future__ import annotations

from typing import Optional

from pydantic import BaseModel, Extra, Field

from ...type import basic, entityReference


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

    description: Optional[basic.Markdown] = Field(
        None, description='Description of the custom metric.'
    )
    name: basic.EntityName = Field(
        ..., description='Name that identifies this Custom 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 Pipeline.'
    )
    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.')
