# generated by datamodel-codegen:
#   filename:  study_schema.json
#   timestamp: 2024-02-07T08:08:38+00:00

from __future__ import annotations

from datetime import date, datetime
from enum import Enum
from typing import List, Optional, Union

from pydantic import BaseModel, constr, Extra, Field

from . import (assay_schema,
               comment_schema,
               factor_schema,
               material_attribute_schema,
               material_schema,
               ontology_annotation_schema,
               person_schema,
               process_schema,
               protocol_schema,
               publication_schema,
               sample_schema,
               source_schema)


class FieldType(Enum):
    Study = 'Study'


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

    field_id: Optional[str] = Field(None, alias='@id')
    field_context: Optional[str] = Field(None, alias='@context')
    field_type: Optional[FieldType] = Field(None, alias='@type')
    filename: Optional[str] = None
    identifier: Optional[str] = None
    title: Optional[str] = None
    description: Optional[str] = None
    submissionDate: Optional[Union[datetime, date, constr(max_length=0)]] = None
    publicReleaseDate: Optional[Union[datetime, date, constr(max_length=0)]] = None
    publications: Optional[List[publication_schema.IsaPublicationSchema]] = None
    people: Optional[List[person_schema.IsaPersonSchema]] = None
    studyDesignDescriptors: Optional[List[
        ontology_annotation_schema.IsaOntologyReferenceSchema]] = None
    protocols: Optional[List[protocol_schema.IsaProtocolSchema]] = None
    materials: Optional[Materials] = None
    processSequence: Optional[List[
        process_schema.
        IsaProcessOrProtocolApplicationSchemaCorrespondsToProtocolRefColumnsInTheStudyAndAssayFiles]] = None
    assays: Optional[List[assay_schema.IsaAssayJsonSchema]] = None
    factors: Optional[List[factor_schema.IsaFactorSchema]] = None
    characteristicCategories: Optional[List[
        material_attribute_schema.IsaMaterialAttributeSchema]] = Field(
            None,
            description=
            'List of all the characteristics categories (or material attributes) defined in the study, used to avoid duplication of their declaration when each material_attribute_value is created. ',
        )
    unitCategories: Optional[List[ontology_annotation_schema.IsaOntologyReferenceSchema]] = Field(
        None,
        description=
        'List of all the units defined in the study, used to avoid duplication of their declaration when each value is created. ',
    )
    comments: Optional[List[
        comment_schema.IsaCommentSchemaItCorrespondsToIsaCommentConstruct]] = None


class Materials(BaseModel):
    sources: Optional[List[source_schema.IsaSourceSchema]] = None
    samples: Optional[List[sample_schema.IsaSampleSchema]] = None
    otherMaterials: Optional[List[material_schema.IsaMaterialSchema]] = None
