from __future__ import annotations
from typing import TYPE_CHECKING

from typing import List, Optional, Union


from pydantic.v1 import Field
from pydantic2_schemaorg.Intangible import Intangible


class StatisticalPopulation(Intangible):
    """A StatisticalPopulation is a set of instances of a certain given type that satisfy some set of constraints.
     The property [[populationType]] is used to specify the type. Any property that can be used on instances of
     that type can appear on the statistical population. For example, a [[StatisticalPopulation]] representing
     all [[Person]]s with a [[homeLocation]] of East Podunk California would be described by applying the appropriate
     [[homeLocation]] and [[populationType]] properties to a [[StatisticalPopulation]] item that stands
     for that set of people. The properties [[numConstraints]] and [[constraintProperty]] are used to specify
     which of the populations properties are used to specify the population. Note that the sense of \"population\"
     used here is the general sense of a statistical population, and does not imply that the population consists
     of people. For example, a [[populationType]] of [[Event]] or [[NewsArticle]] could be used. See also [[Observation]],
     where a [[populationType]] such as [[Person]] or [[Event]] can be indicated directly. In most cases it may
     be better to use [[StatisticalVariable]] instead of [[StatisticalPopulation]].

    See: https://schema.org/StatisticalPopulation
    Model depth: 3
    """

    type_: str = Field(default="StatisticalPopulation", alias="@type", const=True)
    populationType: Optional[Union[List[Union["Class", str]], "Class", str]] = Field(
        default=None,
        description="Indicates the populationType common to all members of a [[StatisticalPopulation]] or all cases within the scope of a [[StatisticalVariable]].",
    )


if TYPE_CHECKING:
    from pydantic2_schemaorg.Class import Class
