# generated by datamodel-codegen:
#   filename:  study_schema.json
#   timestamp: 2024-02-07T14:07:20+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.ISACommentSchema]] = 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
