# coding: utf-8

"""
    IGVF Project API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 108.0.1
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self

class Workflow(BaseModel):
    """
    A workflow for computational analysis of genomic data. A workflow is made up of analysis steps.
    """ # noqa: E501
    preferred_assay_titles: Optional[List[StrictStr]] = Field(default=None, description="The custom lab preferred label for the experiment performed.")
    preview_timestamp: Optional[StrictStr] = Field(default=None, description="The date the object was previewed.")
    source_url: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="An external resource to the code base of the workflow in github.")
    release_timestamp: Optional[StrictStr] = Field(default=None, description="The date the object was released.")
    publications: Optional[List[StrictStr]] = Field(default=None, description="The publications associated with this object.")
    documents: Optional[List[StrictStr]] = Field(default=None, description="Documents that provide additional information (not data file).")
    lab: Optional[StrictStr] = Field(default=None, description="Lab associated with the submission.")
    award: Optional[StrictStr] = Field(default=None, description="Grant associated with the submission.")
    accession: Optional[StrictStr] = Field(default=None, description="A unique identifier to be used to reference the object prefixed with IGVF.")
    alternate_accessions: Optional[List[StrictStr]] = Field(default=None, description="Accessions previously assigned to objects that have been merged with this object.")
    collections: Optional[List[StrictStr]] = Field(default=None, description="Some samples are part of particular data collections.")
    status: Optional[StrictStr] = Field(default=None, description="The status of the metadata object.")
    revoke_detail: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Explanation of why an object was transitioned to the revoked status.")
    schema_version: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The version of the JSON schema that the server uses to validate the object.")
    uuid: Optional[StrictStr] = Field(default=None, description="The unique identifier associated with every object.")
    notes: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="DACC internal notes.")
    aliases: Optional[List[Annotated[str, Field(strict=True)]]] = Field(default=None, description="Lab specific identifiers to reference an object.")
    creation_timestamp: Optional[StrictStr] = Field(default=None, description="The date the object was created.")
    submitted_by: Optional[StrictStr] = Field(default=None, description="The user who submitted the object.")
    submitter_comment: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Additional information specified by the submitter to be displayed as a comment on the portal.")
    description: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A plain text description of the object.")
    name: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The preferred viewable name of the workflow.")
    workflow_repositories: Optional[List[StrictStr]] = Field(default=None, description="Resources hosting the workflow.")
    standards_page: Optional[StrictStr] = Field(default=None, description="A link to a page describing the standards for this workflow.")
    workflow_version: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="The version of this workflow.")
    uniform_pipeline: Optional[StrictBool] = Field(default=None, description="Indicates whether the pipeline is developed by the IGVF consortium.")
    analysis_step_versions: Optional[List[StrictStr]] = Field(default=None, description="The available versions of the analysis steps linked to this workflow.")
    id: Optional[StrictStr] = Field(default=None, alias="@id")
    type: Optional[List[StrictStr]] = Field(default=None, alias="@type")
    summary: Optional[StrictStr] = Field(default=None, description="A summary of the object.")
    __properties: ClassVar[List[str]] = ["preferred_assay_titles", "preview_timestamp", "source_url", "release_timestamp", "publications", "documents", "lab", "award", "accession", "alternate_accessions", "collections", "status", "revoke_detail", "schema_version", "uuid", "notes", "aliases", "creation_timestamp", "submitted_by", "submitter_comment", "description", "name", "workflow_repositories", "standards_page", "workflow_version", "uniform_pipeline", "analysis_step_versions", "@id", "@type", "summary"]

    @field_validator('preferred_assay_titles')
    def preferred_assay_titles_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['RNA-seq', 'scRNA-seq', 'snRNA-seq', 'scNT-seq', 'scNT-seq2', 'scNT-seq3', 'scMultiome-NT-seq', 'Parse SPLiT-seq', 'ATAC-seq', 'varACCESS', 'ACCESS-ATAC', 'scATAC-seq', 'scACCESS-ATAC', 'snATAC-seq', 'mtscMultiome', 'DOGMA-seq', 'DUAL-IPA', '10x multiome', '10x multiome with MULTI-seq', '10x snATAC-seq with Scale pre-indexing', 'snRNA-seq with Scale pre-indexing', 'MULTI-seq', 'SHARE-seq', 'Histone ChIP-seq', 'TF ChIP-seq', 'CUT&RUN', 'MPRA', 'MPRA (scQer)', 'electroporated MPRA', 'AAV-MPRA', 'lentiMPRA', 'STARR-seq', 'Cell painting', 'Variant painting via fluorescence', 'Variant painting via immunostaining', 'Pooled Y2H', 'Arrayed semi-qY2H v1', 'Arrayed semi-qY2H v2', 'Arrayed semi-qY2H v3', 'Arrayed yN2H', 'Arrayed mN2H', 'smFISH', 'MERFISH', 'Proliferation CRISPR screen', 'Migration CRISPR screen', 'CRISPR FlowFISH screen', 'CRISPR FACS screen', 'CRISPR MACS screen', 'CRISPR mCherry screen', 'HCR-FlowFISH screen', 'Variant-EFFECTS', 'scCRISPR screen', 'Perturb-seq', 'Parse Perturb-seq', 'CC-Perturb-seq', 'TAP-seq', 'CROP-seq', 'Multiome Perturb-seq', 'SGE', 'Immune-SGE', 'MAVE', 'MIAA', 'snmC-Seq2', 'snMCT-seq', 'snM3C-seq', 'VAMP-seq', 'VAMP-seq (MultiSTEP)', 'LABEL-seq', 'Hi-C', 'HiCAR', 'Spatial transcriptomics', 'HT-recruit', 'ONT dRNA', 'ONT Fiber-seq', 'ONT direct WGS', 'Bisulfite-seq', 'WGS', 'DNase-seq']):
                raise ValueError("each list item must be one of ('RNA-seq', 'scRNA-seq', 'snRNA-seq', 'scNT-seq', 'scNT-seq2', 'scNT-seq3', 'scMultiome-NT-seq', 'Parse SPLiT-seq', 'ATAC-seq', 'varACCESS', 'ACCESS-ATAC', 'scATAC-seq', 'scACCESS-ATAC', 'snATAC-seq', 'mtscMultiome', 'DOGMA-seq', 'DUAL-IPA', '10x multiome', '10x multiome with MULTI-seq', '10x snATAC-seq with Scale pre-indexing', 'snRNA-seq with Scale pre-indexing', 'MULTI-seq', 'SHARE-seq', 'Histone ChIP-seq', 'TF ChIP-seq', 'CUT&RUN', 'MPRA', 'MPRA (scQer)', 'electroporated MPRA', 'AAV-MPRA', 'lentiMPRA', 'STARR-seq', 'Cell painting', 'Variant painting via fluorescence', 'Variant painting via immunostaining', 'Pooled Y2H', 'Arrayed semi-qY2H v1', 'Arrayed semi-qY2H v2', 'Arrayed semi-qY2H v3', 'Arrayed yN2H', 'Arrayed mN2H', 'smFISH', 'MERFISH', 'Proliferation CRISPR screen', 'Migration CRISPR screen', 'CRISPR FlowFISH screen', 'CRISPR FACS screen', 'CRISPR MACS screen', 'CRISPR mCherry screen', 'HCR-FlowFISH screen', 'Variant-EFFECTS', 'scCRISPR screen', 'Perturb-seq', 'Parse Perturb-seq', 'CC-Perturb-seq', 'TAP-seq', 'CROP-seq', 'Multiome Perturb-seq', 'SGE', 'Immune-SGE', 'MAVE', 'MIAA', 'snmC-Seq2', 'snMCT-seq', 'snM3C-seq', 'VAMP-seq', 'VAMP-seq (MultiSTEP)', 'LABEL-seq', 'Hi-C', 'HiCAR', 'Spatial transcriptomics', 'HT-recruit', 'ONT dRNA', 'ONT Fiber-seq', 'ONT direct WGS', 'Bisulfite-seq', 'WGS', 'DNase-seq')")
        return value

    @field_validator('source_url')
    def source_url_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^https?:\/\/(github\.com\/\S+|support\.parsebiosciences\.com\/\S*|www\.10xgenomics\.com\/\S*)$", value):
            raise ValueError(r"must validate the regular expression /^https?:\/\/(github\.com\/\S+|support\.parsebiosciences\.com\/\S*|www\.10xgenomics\.com\/\S*)$/")
        return value

    @field_validator('collections')
    def collections_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        for i in value:
            if i not in set(['ACMG73', 'Benchmark', 'Bridge Sample', 'ClinGen', 'E2G Pillar Project', 'ENCODE', 'GREGoR', 'IGVF_catalog_beta_v0.1', 'IGVF_catalog_beta_v0.2', 'IGVF_catalog_beta_v0.3', 'IGVF_catalog_beta_v0.4', 'IGVF_catalog_beta_v0.5', 'IGVF_catalog_v1.0', 'IGVF phase 1', 'MaveDB', 'Morphic', 'MPRAbase', 'StanfordFCC', 'TF Perturb-seq Project', 'TOPMED Freeze 8', 'VarChAMP', 'Vista', 'Williams Syndrome Research']):
                raise ValueError("each list item must be one of ('ACMG73', 'Benchmark', 'Bridge Sample', 'ClinGen', 'E2G Pillar Project', 'ENCODE', 'GREGoR', 'IGVF_catalog_beta_v0.1', 'IGVF_catalog_beta_v0.2', 'IGVF_catalog_beta_v0.3', 'IGVF_catalog_beta_v0.4', 'IGVF_catalog_beta_v0.5', 'IGVF_catalog_v1.0', 'IGVF phase 1', 'MaveDB', 'Morphic', 'MPRAbase', 'StanfordFCC', 'TF Perturb-seq Project', 'TOPMED Freeze 8', 'VarChAMP', 'Vista', 'Williams Syndrome Research')")
        return value

    @field_validator('status')
    def status_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['in progress', 'preview', 'released', 'deleted', 'replaced', 'revoked', 'archived']):
            raise ValueError("must be one of enum values ('in progress', 'preview', 'released', 'deleted', 'replaced', 'revoked', 'archived')")
        return value

    @field_validator('revoke_detail')
    def revoke_detail_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^(\S+(\s|\S)*\S+|\S)$", value):
            raise ValueError(r"must validate the regular expression /^(\S+(\s|\S)*\S+|\S)$/")
        return value

    @field_validator('schema_version')
    def schema_version_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^\d+(\.\d+)*$", value):
            raise ValueError(r"must validate the regular expression /^\d+(\.\d+)*$/")
        return value

    @field_validator('notes')
    def notes_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^(\S+(\s|\S)*\S+|\S)$", value):
            raise ValueError(r"must validate the regular expression /^(\S+(\s|\S)*\S+|\S)$/")
        return value

    @field_validator('submitter_comment')
    def submitter_comment_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^(\S+(\s|\S)*\S+|\S)$", value):
            raise ValueError(r"must validate the regular expression /^(\S+(\s|\S)*\S+|\S)$/")
        return value

    @field_validator('description')
    def description_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^(\S+(\s|\S)*\S+|\S)$", value):
            raise ValueError(r"must validate the regular expression /^(\S+(\s|\S)*\S+|\S)$/")
        return value

    @field_validator('name')
    def name_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^(\S+(\s|\S)*\S+|\S)$", value):
            raise ValueError(r"must validate the regular expression /^(\S+(\s|\S)*\S+|\S)$/")
        return value

    @field_validator('workflow_version')
    def workflow_version_validate_regular_expression(cls, value):
        """Validates the regular expression"""
        if value is None:
            return value

        if not re.match(r"^v(?!0\.0\.0$)([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?|0\.0\.0\.[1-9][0-9]*)$", value):
            raise ValueError(r"must validate the regular expression /^v(?!0\.0\.0$)([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?|0\.0\.0\.[1-9][0-9]*)$/")
        return value

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of Workflow from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of Workflow from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "preferred_assay_titles": obj.get("preferred_assay_titles"),
            "preview_timestamp": obj.get("preview_timestamp"),
            "source_url": obj.get("source_url"),
            "release_timestamp": obj.get("release_timestamp"),
            "publications": obj.get("publications"),
            "documents": obj.get("documents"),
            "lab": obj.get("lab"),
            "award": obj.get("award"),
            "accession": obj.get("accession"),
            "alternate_accessions": obj.get("alternate_accessions"),
            "collections": obj.get("collections"),
            "status": obj.get("status"),
            "revoke_detail": obj.get("revoke_detail"),
            "schema_version": obj.get("schema_version"),
            "uuid": obj.get("uuid"),
            "notes": obj.get("notes"),
            "aliases": obj.get("aliases"),
            "creation_timestamp": obj.get("creation_timestamp"),
            "submitted_by": obj.get("submitted_by"),
            "submitter_comment": obj.get("submitter_comment"),
            "description": obj.get("description"),
            "name": obj.get("name"),
            "workflow_repositories": obj.get("workflow_repositories"),
            "standards_page": obj.get("standards_page"),
            "workflow_version": obj.get("workflow_version"),
            "uniform_pipeline": obj.get("uniform_pipeline"),
            "analysis_step_versions": obj.get("analysis_step_versions"),
            "@id": obj.get("@id"),
            "@type": obj.get("@type"),
            "summary": obj.get("summary")
        })
        return _obj


