# -*- mode:python; coding:utf-8 -*-
# Copyright (c) 2020 IBM Corp. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
#
####### DO NOT EDIT DO NOT EDIT DO NOT EDIT DO NOT EDIT DO NOT EDIT ######
#                                                                        #
#        This file is automatically generated by gen_oscal.py            #
#                                                                        #
####### DO NOT EDIT DO NOT EDIT DO NOT EDIT DO NOT EDIT DO NOT EDIT ######
#
#
from __future__ import annotations

import re
from datetime import datetime
from enum import Enum
from typing import Any, Dict, List, Optional

from pydantic import AnyUrl, EmailStr, Extra, Field, conint, constr, validator

from trestle.core.base_model import OscalBaseModel
from trestle.oscal import OSCAL_VERSION_REGEX, OSCAL_VERSION


class AddrLine(OscalBaseModel):
    __root__: constr(regex=r'^\S(.*\S)?$'
                     ) = Field(..., description='A single line of an address.', title='Address line')


class Address(OscalBaseModel):
    """
    A postal address for the location.
    """

    class Config:
        extra = Extra.forbid

    type: Optional[constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    )] = Field(
        None, description='Indicates the type of address.', title='Address Type'
    )
    addr_lines: Optional[List[AddrLine]] = Field(None, alias='addr-lines')
    city: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None,
        description='City, town or geographical region for the mailing address.',
        title='City',
    )
    state: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None,
        description='State, province or analogous geographical region for mailing address',
        title='State',
    )
    postal_code: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None,
        alias='postal-code',
        description='Postal or ZIP code for mailing address',
        title='Postal Code',
    )
    country: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None,
        description='The ISO 3166-1 alpha-2 country code for the mailing address.',
        title='Country Code',
    )


class WithinDateRange(OscalBaseModel):
    """
    The task is intended to occur within the specified date range.
    """

    class Config:
        extra = Extra.forbid

    start: datetime = Field(
        ...,
        description='The task must occur on or after the specified date.',
        title='Start Date Condition',
    )
    end: datetime = Field(
        ...,
        description='The task must occur on or before the specified date.',
        title='End Date Condition',
    )


class Version(OscalBaseModel):
    __root__: constr(regex=r'^\S(.*\S)?$') = Field(
        ...,
        description=
        'A string used to distinguish the current version of the document from other previous (and future) versions.',
        title='Document Version',
    )


class Value(OscalBaseModel):
    __root__: constr(regex=r'^\S(.*\S)?$'
                     ) = Field(..., description='A parameter value or set of values.', title='Parameter Value')


class Unit(Enum):
    """
    The unit of time for the period.
    """

    seconds = 'seconds'
    minutes = 'minutes'
    hours = 'hours'
    days = 'days'
    months = 'months'
    years = 'years'


class Type3(Enum):
    """
    The kind of actor.
    """

    tool = 'tool'
    assessment_platform = 'assessment-platform'
    party = 'party'


class Type2(OscalBaseModel):
    __root__: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description=
        'Identifies the nature of the observation. More than one may be used to further qualify and enable filtering.',
        title='Observation Type',
    )


class Type1(Enum):
    """
    Identifies the type of the target.
    """

    statement_id = 'statement-id'
    objective_id = 'objective-id'


class Type(Enum):
    """
    A category describing the kind of party the object describes.
    """

    person = 'person'
    organization = 'organization'


class Transport(Enum):
    """
    Indicates the transport type.
    """

    TCP = 'TCP'
    UDP = 'UDP'


class ThreatId(OscalBaseModel):
    """
    A pointer, by ID, to an externally-defined threat.
    """

    class Config:
        extra = Extra.forbid

    system: AnyUrl = Field(
        ...,
        description='Specifies the source of the threat information.',
        title='Threat Type Identification System',
    )
    href: Optional[str] = Field(
        None,
        description='An optional location for the threat data, from which this ID originates.',
        title='Threat Information Resource Reference',
    )
    id: str


class TelephoneNumber(OscalBaseModel):
    """
    Contact number by telephone.
    """

    class Config:
        extra = Extra.forbid

    type: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None, description='Indicates the type of phone number.', title='type flag'
    )
    number: str


class SystemId(OscalBaseModel):
    """
    A human-oriented, globally unique identifier with cross-instance scope that can be used to reference this system identification property elsewhere in this or other OSCAL instances. When referencing an externally defined system identification, the system identification must be used in the context of the external / imported OSCAL instance (e.g., uri-reference). This string should be assigned per-subject, which means it should be consistently used to identify the same system across revisions of the document.
    """

    class Config:
        extra = Extra.forbid

    identifier_type: Optional[AnyUrl] = Field(
        None,
        alias='identifier-type',
        description='Identifies the identification system from which the provided identifier was assigned.',
        title='Identification System Type',
    )
    id: str


class StatementId(OscalBaseModel):
    __root__: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description='Used to constrain the selection to only specificity identified statements.',
        title='Include Specific Statements',
    )


class Source(OscalBaseModel):
    """
    Assessment subjects will be identified while conducting the referenced activity-instance.
    """

    class Config:
        extra = Extra.forbid

    task_uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        alias='task-uuid',
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference (in this or other OSCAL instances) an assessment activity to be performed as part of the event. The locally defined UUID of the task can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Task Universally Unique Identifier',
    )


class SelectObjectiveById(OscalBaseModel):
    """
    Used to select a control objective for inclusion/exclusion based on the control objective's identifier.
    """

    class Config:
        extra = Extra.forbid

    objective_id: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        alias='objective-id',
        description='Points to an assessment objective.',
        title='Objective ID',
    )


class RoleId(OscalBaseModel):
    __root__: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description='A human-oriented identifier reference to roles served by the user.',
        title='Role Identifier Reference',
    )


class RiskStatus(OscalBaseModel):
    __root__: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description='Describes the status of the associated risk.',
        title='Risk Status',
    )


class Remarks(OscalBaseModel):
    __root__: str = Field(
        ...,
        description='Additional commentary on the containing object.',
        title='Remarks',
    )


class RelatedRisk(OscalBaseModel):
    """
    Relates the finding to a set of referenced risks that were used to determine the finding.
    """

    class Config:
        extra = Extra.forbid

    risk_uuid: constr(regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
                      ) = Field(
                          ...,
                          alias='risk-uuid',
                          description='A machine-oriented identifier reference to a risk defined in the list of risks.',
                          title='Risk Universally Unique Identifier Reference',
                      )


class RelatedObservation1(OscalBaseModel):
    """
    Relates the finding to a set of referenced observations that were used to determine the finding.
    """

    class Config:
        extra = Extra.forbid

    observation_uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        alias='observation-uuid',
        description='A machine-oriented identifier reference to an observation defined in the list of observations.',
        title='Observation Universally Unique Identifier Reference',
    )


class Published(OscalBaseModel):
    __root__: datetime = Field(
        ...,
        description=
        'The date and time the document was published. The date-time value must be formatted according to RFC 3339 with full time and time zone included.',
        title='Publication Timestamp',
    )


class Property(OscalBaseModel):
    """
    An attribute, characteristic, or quality of the containing object expressed as a namespace qualified name/value pair. The value of a property is a simple scalar value, which may be expressed as a list of values.
    """

    class Config:
        extra = Extra.forbid

    name: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description=
        "A textual label that uniquely identifies a specific attribute, characteristic, or quality of the property's containing object.",
        title='Property Name',
    )
    uuid: Optional[constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    )] = Field(
        None,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this defined property elsewhere in this or other OSCAL instances. This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Property Universally Unique Identifier',
    )
    ns: Optional[AnyUrl] = Field(
        None,
        description=
        "A namespace qualifying the property's name. This allows different organizations to associate distinct semantics with the same name.",
        title='Property Namespace',
    )
    value: constr(regex=r'^\S(.*\S)?$') = Field(
        ...,
        description='Indicates the value of the attribute, characteristic, or quality.',
        title='Property Value',
    )
    class_: Optional[constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    )] = Field(
        None,
        alias='class',
        description=
        "A textual label that provides a sub-type or characterization of the property's name. This can be used to further distinguish or discriminate between the semantics of multiple properties of the same object with the same name and ns.",
        title='Property Class',
    )
    remarks: Optional[Remarks] = None


class PortRange(OscalBaseModel):
    """
    Where applicable this is the IPv4 port range on which the service operates.
    """

    class Config:
        extra = Extra.forbid

    start: Optional[conint(ge=0, multiple_of=1)] = Field(
        None,
        description='Indicates the starting port number in a port range',
        title='Start',
    )
    end: Optional[conint(ge=0, multiple_of=1)] = Field(
        None,
        description='Indicates the ending port number in a port range',
        title='End',
    )
    transport: Optional[Transport] = Field(None, description='Indicates the transport type.', title='Transport')


class Protocol(OscalBaseModel):
    """
    Information about the protocol used to provide a service.
    """

    class Config:
        extra = Extra.forbid

    uuid: Optional[constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    )] = Field(
        None,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this service protocol information elsewhere in this or other OSCAL instances. The locally defined UUID of the service protocol can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Service Protocol Information Universally Unique Identifier',
    )
    name: constr(regex=r'^\S(.*\S)?$') = Field(
        ...,
        description=
        'The common name of the protocol, which should be the appropriate "service name" from the IANA Service Name and Transport Protocol Port Number Registry.',
        title='Protocol Name',
    )
    title: Optional[str] = Field(
        None,
        description='A human readable name for the protocol (e.g., Transport Layer Security).',
        title='Protocol Title',
    )
    port_ranges: Optional[List[PortRange]] = Field(None, alias='port-ranges')


class PartyUuid(OscalBaseModel):
    __root__: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented identifier reference to another party defined in metadata. The UUID of the party in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance).',
        title='Party Reference',
    )


class ParameterValue(OscalBaseModel):
    __root__: constr(regex=r'^\S(.*\S)?$'
                     ) = Field(..., description='A parameter value or set of values.', title='Parameter Value')


class ParameterGuideline(OscalBaseModel):
    """
    A prose statement that provides a recommendation for the use of a parameter.
    """

    class Config:
        extra = Extra.forbid

    prose: str = Field(
        ...,
        description='Prose permits multiple paragraphs, lists, tables etc.',
        title='Guideline Text',
    )


class OscalVersion(OscalBaseModel):
    __root__: constr(regex=r'^\S(.*\S)?$') = Field(
        ...,
        description='The OSCAL model version the document was authored against.',
        title='OSCAL version',
    )

    @validator('__root__')
    def oscal_version_is_valid(cls, v):
        p = re.compile(OSCAL_VERSION_REGEX)
        matched = p.match(v)
        if matched is None:
            raise ValueError(f'OSCAL version: {v} is not supported, use {OSCAL_VERSION} instead.')
        return v


class OnDate(OscalBaseModel):
    """
    The task is intended to occur on the specified date.
    """

    class Config:
        extra = Extra.forbid

    date: datetime = Field(
        ...,
        description='The task must occur on the specified date.',
        title='On Date Condition',
    )


class MemberOfOrganization(OscalBaseModel):
    __root__: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented identifier reference to another party (person or organization) that this subject is associated with. The UUID of the party in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance).',
        title='Organizational Affiliation',
    )


class LoggedBy(OscalBaseModel):
    """
    Used to indicate who created a log entry in what role.
    """

    class Config:
        extra = Extra.forbid

    party_uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        alias='party-uuid',
        description='A machine-oriented identifier reference to the party who is making the log entry.',
        title='Party UUID Reference',
    )
    role_id: Optional[constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    )] = Field(
        None,
        alias='role-id',
        description='A point to the role-id of the role in which the party is making the log entry.',
        title='Actor Role',
    )


class LocationUuid(OscalBaseModel):
    __root__: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented identifier reference to a location defined in the metadata section of this or another OSCAL instance. The UUID of the location in the source OSCAL instance is sufficient to reference the data item locally or globally (e.g., in an imported OSCAL instance).',
        title='Location Reference',
    )


class Link(OscalBaseModel):
    """
    A reference to a local or remote resource
    """

    class Config:
        extra = Extra.forbid

    href: str = Field(
        ...,
        description='A resolvable URL reference to a resource.',
        title='Hypertext Reference',
    )
    rel: Optional[constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    )] = Field(
        None,
        description=
        "Describes the type of relationship provided by the link. This can be an indicator of the link's purpose.",
        title='Relation',
    )
    media_type: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None,
        alias='media-type',
        description=
        'Specifies a media type as defined by the Internet Assigned Numbers Authority (IANA) Media Types Registry.',
        title='Media Type',
    )
    text: Optional[str] = Field(
        None,
        description='A textual label to associate with the link, which may be used for presentation in a tool.',
        title='Link Text',
    )


class LastModified(OscalBaseModel):
    __root__: datetime = Field(
        ...,
        description=
        'The date and time the document was last modified. The date-time value must be formatted according to RFC 3339 with full time and time zone included.',
        title='Last Modified Timestamp',
    )


class IncludeAll(OscalBaseModel):
    """
    Include all controls from the imported catalog or profile resources.
    """

    pass

    class Config:
        extra = Extra.forbid


class ImportSsp(OscalBaseModel):
    """
    Used by the assessment plan and POA&M to import information about the system.
    """

    class Config:
        extra = Extra.forbid

    href: str = Field(
        ...,
        description='A resolvable URL reference to the system security plan for the system being assessed.',
        title='System Security Plan Reference',
    )
    remarks: Optional[Remarks] = None


class ImplementationStatus(OscalBaseModel):
    """
    Indicates the degree to which the a given control is implemented.
    """

    class Config:
        extra = Extra.forbid

    state: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description='Identifies the implementation status of the control or control objective.',
        title='Implementation State',
    )
    remarks: Optional[Remarks] = None


class HowMany(Enum):
    """
    Describes the number of selections that must occur. Without this setting, only one value should be assumed to be permitted.
    """

    one = 'one'
    one_or_more = 'one-or-more'


class Hash(OscalBaseModel):
    """
    A representation of a cryptographic digest generated over a resource using a specified hash algorithm.
    """

    class Config:
        extra = Extra.forbid

    algorithm: constr(regex=r'^\S(.*\S)?$'
                      ) = Field(..., description='Method by which a hash is derived', title='Hash algorithm')
    value: str


class FunctionPerformed(OscalBaseModel):
    __root__: constr(regex=r'^\S(.*\S)?$') = Field(
        ...,
        description='Describes a function performed for a given authorized privilege by this user class.',
        title='Functions Performed',
    )


class Facet(OscalBaseModel):
    """
    An individual characteristic that is part of a larger set produced by the same actor.
    """

    class Config:
        extra = Extra.forbid

    name: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description='The name of the risk metric within the specified system.',
        title='Facet Name',
    )
    system: AnyUrl = Field(
        ...,
        description=
        'Specifies the naming system under which this risk metric is organized, which allows for the same names to be used in different systems controlled by different parties. This avoids the potential of a name clash.',
        title='Naming System',
    )
    value: constr(regex=r'^\S(.*\S)?$'
                  ) = Field(..., description='Indicates the value of the facet.', title='Facet Value')
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    remarks: Optional[Remarks] = None


class ExternalId(OscalBaseModel):
    """
    An identifier for a person or organization using a designated scheme. e.g. an Open Researcher and Contributor ID (ORCID)
    """

    class Config:
        extra = Extra.forbid

    scheme: AnyUrl = Field(
        ...,
        description='Indicates the type of external identifier.',
        title='External Identifier Schema',
    )
    id: str


class EmailAddress(OscalBaseModel):
    __root__: EmailStr = Field(
        ...,
        description='An email address as defined by RFC 5322 Section 3.4.1.',
        title='Email Address',
    )


class DocumentId(OscalBaseModel):
    """
    A document identifier qualified by an identifier scheme. A document identifier provides a globally unique identifier with a cross-instance scope that is used for a group of documents that are to be treated as different versions of the same document. If this element does not appear, or if the value of this element is empty, the value of "document-id" is equal to the value of the "uuid" flag of the top-level root element.
    """

    class Config:
        extra = Extra.forbid

    scheme: Optional[AnyUrl] = Field(
        None,
        description=
        'Qualifies the kind of document identifier using a URI. If the scheme is not provided the value of the element will be interpreted as a string of characters.',
        title='Document Identification Scheme',
    )
    identifier: str


class Dependency(OscalBaseModel):
    """
    Used to indicate that a task is dependent on another task.
    """

    class Config:
        extra = Extra.forbid

    task_uuid: constr(regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
                      ) = Field(
                          ...,
                          alias='task-uuid',
                          description='A machine-oriented identifier reference to a unique task.',
                          title='Task Universally Unique Identifier Reference',
                      )
    remarks: Optional[Remarks] = None


class ControlObjectiveSelection(OscalBaseModel):
    """
    Identifies the control objectives of the assessment. In the assessment plan, these are the planned objectives. In the assessment results, these are the assessed objectives, and reflects any changes from the plan.
    """

    class Config:
        extra = Extra.forbid

    description: Optional[str] = Field(
        None,
        description='A human-readable description of this collection of control objectives.',
        title='Control Objectives Description',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    include_all: Optional[IncludeAll] = Field(None, alias='include-all')
    include_objectives: Optional[List[SelectObjectiveById]] = Field(None, alias='include-objectives')
    exclude_objectives: Optional[List[SelectObjectiveById]] = Field(None, alias='exclude-objectives')
    remarks: Optional[Remarks] = None


class Citation(OscalBaseModel):
    """
    A citation consisting of end note text and optional structured bibliographic data.
    """

    class Config:
        extra = Extra.forbid

    text: str = Field(..., description='A line of citation text.', title='Citation Text')
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)


class Base64(OscalBaseModel):
    """
    The Base64 alphabet in RFC 2045 - aligned with XSD.
    """

    class Config:
        extra = Extra.forbid

    filename: Optional[str] = Field(
        None,
        description=
        'Name of the file before it was encoded as Base64 to be embedded in a resource. This is the name that will be assigned to the file when the file is decoded.',
        title='File Name',
    )
    media_type: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None,
        alias='media-type',
        description=
        'Specifies a media type as defined by the Internet Assigned Numbers Authority (IANA) Media Types Registry.',
        title='Media Type',
    )
    value: str


class AuthorizedPrivilege(OscalBaseModel):
    """
    Identifies a specific system privilege held by the user, along with an associated description and/or rationale for the privilege.
    """

    class Config:
        extra = Extra.forbid

    title: str = Field(
        ...,
        description='A human readable name for the privilege.',
        title='Privilege Title',
    )
    description: Optional[str] = Field(
        None,
        description="A summary of the privilege's purpose within the system.",
        title='Privilege Description',
    )
    functions_performed: List[FunctionPerformed] = Field(..., alias='functions-performed')


class AtFrequency(OscalBaseModel):
    """
    The task is intended to occur at the specified frequency.
    """

    class Config:
        extra = Extra.forbid

    period: conint(
        ge=1, multiple_of=1
    ) = Field(
        ...,
        description='The task must occur after the specified period has elapsed.',
        title='Period',
    )
    unit: Unit = Field(..., description='The unit of time for the period.', title='Time Unit')


class AssessmentSubjectPlaceholder(OscalBaseModel):
    """
    Used when the assessment subjects will be determined as part of one or more other assessment activities. These assessment subjects will be recorded in the assessment results in the assessment log.
    """

    class Config:
        extra = Extra.forbid

    uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented, globally unique identifier for a set of assessment subjects that will be identified by a task or an activity that is part of a task. The locally defined UUID of the assessment subject placeholder can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Assessment Subject Placeholder Universally Unique Identifier',
    )
    description: Optional[str] = Field(
        None,
        description='A human-readable description of intent of this assessment subject placeholder.',
        title='Assessment Subject Placeholder Description',
    )
    sources: List[Source] = Field(...)
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    remarks: Optional[Remarks] = None


class AssessmentPart(OscalBaseModel):
    """
    A partition of an assessment plan or results or a child of another part.
    """

    class Config:
        extra = Extra.forbid

    uuid: Optional[constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    )] = Field(
        None,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this part elsewhere in this or other OSCAL instances. The locally defined UUID of the part can be used to reference the data item locally or globally (e.g., in an ported OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Part Identifier',
    )
    name: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description="A textual label that uniquely identifies the part's semantic type.",
        title='Part Name',
    )
    ns: Optional[AnyUrl] = Field(
        None,
        description=
        "A namespace qualifying the part's name. This allows different organizations to associate distinct semantics with the same name.",
        title='Part Namespace',
    )
    class_: Optional[constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    )] = Field(
        None,
        alias='class',
        description=
        "A textual label that provides a sub-type or characterization of the part's name. This can be used to further distinguish or discriminate between the semantics of multiple parts of the same control with the same name and ns.",
        title='Part Class',
    )
    title: Optional[str] = Field(
        None,
        description='A name given to the part, which may be used by a tool for display and navigation.',
        title='Part Title',
    )
    props: Optional[List[Property]] = Field(None)
    prose: Optional[str] = Field(
        None,
        description='Permits multiple paragraphs, lists, tables etc.',
        title='Part Text',
    )
    parts: Optional[List[AssessmentPart]] = None
    links: Optional[List[Link]] = Field(None)


class Timing(OscalBaseModel):
    """
    The timing under which the task is intended to occur.
    """

    class Config:
        extra = Extra.forbid

    on_date: Optional[OnDate] = Field(
        None,
        alias='on-date',
        description='The task is intended to occur on the specified date.',
        title='On Date Condition',
    )
    within_date_range: Optional[WithinDateRange] = Field(
        None,
        alias='within-date-range',
        description='The task is intended to occur within the specified date range.',
        title='On Date Range Condition',
    )
    at_frequency: Optional[AtFrequency] = Field(
        None,
        alias='at-frequency',
        description='The task is intended to occur at the specified frequency.',
        title='Frequency Condition',
    )


class Test(OscalBaseModel):
    """
    A test expression which is expected to be evaluated by a tool.
    """

    class Config:
        extra = Extra.forbid

    expression: constr(regex=r'^\S(.*\S)?$') = Field(
        ...,
        description='A formal (executable) expression of a constraint',
        title='Constraint test',
    )
    remarks: Optional[Remarks] = None


class ParameterConstraint(OscalBaseModel):
    """
    A formal or informal expression of a constraint or test
    """

    class Config:
        extra = Extra.forbid

    description: Optional[str] = Field(
        None,
        description='A textual summary of the constraint to be applied.',
        title='Constraint Description',
    )
    tests: Optional[List[Test]] = Field(None)


class SystemUser(OscalBaseModel):
    """
    A type of user that interacts with the system based on an associated role.
    """

    class Config:
        extra = Extra.forbid

    uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this user class elsewhere in this or other OSCAL instances. The locally defined UUID of the system user can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='User Universally Unique Identifier',
    )
    title: Optional[str] = Field(
        None,
        description='A name given to the user, which may be used by a tool for display and navigation.',
        title='User Title',
    )
    short_name: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None,
        alias='short-name',
        description='A short common name, abbreviation, or acronym for the user.',
        title='User Short Name',
    )
    description: Optional[str] = Field(
        None,
        description="A summary of the user's purpose within the system.",
        title='User Description',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    role_ids: Optional[List[RoleId]] = Field(None, alias='role-ids')
    authorized_privileges: Optional[List[AuthorizedPrivilege]] = Field(None, alias='authorized-privileges')
    remarks: Optional[Remarks] = None


class SubjectReference(OscalBaseModel):
    """
    A human-oriented identifier reference to a resource. Use type to indicate whether the identified resource is a component, inventory item, location, user, or something else.
    """

    class Config:
        extra = Extra.forbid

    subject_uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        alias='subject-uuid',
        description=
        "A machine-oriented identifier reference to a component, inventory-item, location, party, user, or resource using it's UUID.",
        title='Subject Universally Unique Identifier Reference',
    )
    type: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description='Used to indicate the type of object pointed to by the uuid-ref within a subject.',
        title='Subject Universally Unique Identifier Reference Type',
    )
    title: Optional[str] = Field(
        None,
        description='The title or name for the referenced subject.',
        title='Subject Reference Title',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    remarks: Optional[Remarks] = None


class MitigatingFactor(OscalBaseModel):
    """
    Describes an existing mitigating factor that may affect the overall determination of the risk, with an optional link to an implementation statement in the SSP.
    """

    class Config:
        extra = Extra.forbid

    uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this mitigating factor elsewhere in this or other OSCAL instances. The locally defined UUID of the mitigating factor can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Mitigating Factor Universally Unique Identifier',
    )
    implementation_uuid: Optional[constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    )] = Field(
        None,
        alias='implementation-uuid',
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this implementation statement elsewhere in this or other OSCAL instancess. The locally defined UUID of the implementation statement can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Implementation UUID',
    )
    description: str = Field(
        ...,
        description='A human-readable description of this mitigating factor.',
        title='Mitigating Factor Description',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    subjects: Optional[List[SubjectReference]] = Field(None)


class SelectSubjectById(OscalBaseModel):
    """
    Identifies a set of assessment subjects to include/exclude by UUID.
    """

    class Config:
        extra = Extra.forbid

    subject_uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        alias='subject-uuid',
        description=
        "A machine-oriented identifier reference to a component, inventory-item, location, party, user, or resource using it's UUID.",
        title='Subject Universally Unique Identifier Reference',
    )
    type: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description='Used to indicate the type of object pointed to by the uuid-ref within a subject.',
        title='Subject Universally Unique Identifier Reference Type',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    remarks: Optional[Remarks] = None


class AssessmentSubject(OscalBaseModel):
    """
    Identifies system elements being assessed, such as components, inventory items, and locations. In the assessment plan, this identifies a planned assessment subject. In the assessment results this is an actual assessment subject, and reflects any changes from the plan. exactly what will be the focus of this assessment. Any subjects not identified in this way are out-of-scope.
    """

    class Config:
        extra = Extra.forbid

    type: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description=
        'Indicates the type of assessment subject, such as a component, inventory, item, location, or party represented by this selection statement.',
        title='Subject Type',
    )
    description: Optional[str] = Field(
        None,
        description='A human-readable description of the collection of subjects being included in this assessment.',
        title='Include Subjects Description',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    include_all: Optional[IncludeAll] = Field(None, alias='include-all')
    include_subjects: Optional[List[SelectSubjectById]] = Field(None, alias='include-subjects')
    exclude_subjects: Optional[List[SelectSubjectById]] = Field(None, alias='exclude-subjects')
    remarks: Optional[Remarks] = None


class Role(OscalBaseModel):
    """
    Defines a function assumed or expected to be assumed by a party in a specific situation.
    """

    class Config:
        extra = Extra.forbid

    id: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description=
        'A human-oriented, locally unique identifier with cross-instance scope that can be used to reference this defined role elsewhere in this or other OSCAL instances. When referenced from another OSCAL instance, the locally defined ID of the Role from the imported OSCAL instance must be referenced in the context of the containing resource (e.g., import, import-component-definition, import-profile, import-ssp or import-ap). This ID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Role Identifier',
    )
    title: str = Field(
        ...,
        description='A name given to the role, which may be used by a tool for display and navigation.',
        title='Role Title',
    )
    short_name: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None,
        alias='short-name',
        description='A short common name, abbreviation, or acronym for the role.',
        title='Role Short Name',
    )
    description: Optional[str] = Field(
        None,
        description="A summary of the role's purpose and associated responsibilities.",
        title='Role Description',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    remarks: Optional[Remarks] = None


class Rlink(OscalBaseModel):
    """
    A pointer to an external resource with an optional hash for verification and change detection.
    """

    class Config:
        extra = Extra.forbid

    href: str = Field(
        ...,
        description='A resolvable URI reference to a resource.',
        title='Hypertext Reference',
    )
    media_type: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None,
        alias='media-type',
        description=
        'Specifies a media type as defined by the Internet Assigned Numbers Authority (IANA) Media Types Registry.',
        title='Media Type',
    )
    hashes: Optional[List[Hash]] = Field(None)


class Resource(OscalBaseModel):
    """
    A resource associated with content in the containing document. A resource may be directly included in the document base64 encoded or may point to one or more equivalent internet resources.
    """

    class Config:
        extra = Extra.forbid

    uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this defined resource elsewhere in this or other OSCAL instances. This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Resource Universally Unique Identifier',
    )
    title: Optional[str] = Field(
        None,
        description='A name given to the resource, which may be used by a tool for display and navigation.',
        title='Resource Title',
    )
    description: Optional[str] = Field(
        None,
        description='A short summary of the resource used to indicate the purpose of the resource.',
        title='Resource Description',
    )
    props: Optional[List[Property]] = Field(None)
    document_ids: Optional[List[DocumentId]] = Field(None, alias='document-ids')
    citation: Optional[Citation] = Field(
        None,
        description='A citation consisting of end note text and optional structured bibliographic data.',
        title='Citation',
    )
    rlinks: Optional[List[Rlink]] = Field(None)
    base64: Optional[Base64] = Field(
        None,
        description='The Base64 alphabet in RFC 2045 - aligned with XSD.',
        title='Base64',
    )
    remarks: Optional[Remarks] = None


class BackMatter(OscalBaseModel):
    """
    A collection of resources, which may be included directly or by reference.
    """

    class Config:
        extra = Extra.forbid

    resources: Optional[List[Resource]] = Field(None)


class Revision(OscalBaseModel):
    """
    An entry in a sequential list of revisions to the containing document in reverse chronological order (i.e., most recent previous revision first).
    """

    class Config:
        extra = Extra.forbid

    title: Optional[str] = Field(
        None,
        description='A name given to the document revision, which may be used by a tool for display and navigation.',
        title='Document Title',
    )
    published: Optional[Published] = None
    last_modified: Optional[LastModified] = Field(None, alias='last-modified')
    version: Version
    oscal_version: Optional[OscalVersion] = Field(None, alias='oscal-version')
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    remarks: Optional[Remarks] = None


class ResponsibleRole(OscalBaseModel):
    """
    A reference to one or more roles with responsibility for performing a function relative to the containing object.
    """

    class Config:
        extra = Extra.forbid

    role_id: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        alias='role-id',
        description='A human-oriented identifier reference to roles responsible for the business function.',
        title='Responsible Role ID',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    party_uuids: Optional[List[PartyUuid]] = Field(None, alias='party-uuids')
    remarks: Optional[Remarks] = None


class ResponsibleParty(OscalBaseModel):
    """
    A reference to a set of organizations or persons that have responsibility for performing a referenced role in the context of the containing object.
    """

    class Config:
        extra = Extra.forbid

    role_id: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        alias='role-id',
        description='A human-oriented identifier reference to roles served by the user.',
        title='Responsible Role',
    )
    party_uuids: List[PartyUuid] = Field(..., alias='party-uuids')
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    remarks: Optional[Remarks] = None


class RequiredAsset(OscalBaseModel):
    """
    Identifies an asset required to achieve remediation.
    """

    class Config:
        extra = Extra.forbid

    uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this required asset elsewhere in this or other OSCAL instances. The locally defined UUID of the asset can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Required Universally Unique Identifier',
    )
    subjects: Optional[List[SubjectReference]] = Field(None)
    title: Optional[str] = Field(
        None,
        description='The title for this required asset.',
        title='Title for Required Asset',
    )
    description: str = Field(
        ...,
        description='A human-readable description of this required asset.',
        title='Description of Required Asset',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    remarks: Optional[Remarks] = None


class RelevantEvidence(OscalBaseModel):
    """
    Links this observation to relevant evidence.
    """

    class Config:
        extra = Extra.forbid

    href: Optional[str] = Field(
        None,
        description='A resolvable URL reference to relevant evidence.',
        title='Relevant Evidence Reference',
    )
    description: str = Field(
        ...,
        description='A human-readable description of this evidence.',
        title='Relevant Evidence Description',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    remarks: Optional[Remarks] = None


class Party(OscalBaseModel):
    """
    A responsible entity which is either a person or an organization.
    """

    class Config:
        extra = Extra.forbid

    uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this defined party elsewhere in this or other OSCAL instances. The locally defined UUID of the party can be used to reference the data item locally or globally (e.g., from an importing OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Party Universally Unique Identifier',
    )
    type: Type = Field(
        ...,
        description='A category describing the kind of party the object describes.',
        title='Party Type',
    )
    name: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None,
        description='The full name of the party. This is typically the legal name associated with the party.',
        title='Party Name',
    )
    short_name: Optional[constr(regex=r'^\S(.*\S)?$')] = Field(
        None,
        alias='short-name',
        description='A short common name, abbreviation, or acronym for the party.',
        title='Party Short Name',
    )
    external_ids: Optional[List[ExternalId]] = Field(None, alias='external-ids')
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    email_addresses: Optional[List[EmailAddress]] = Field(None, alias='email-addresses')
    telephone_numbers: Optional[List[TelephoneNumber]] = Field(None, alias='telephone-numbers')
    addresses: Optional[List[Address]] = Field(None)
    location_uuids: Optional[List[LocationUuid]] = Field(None, alias='location-uuids')
    member_of_organizations: Optional[List[MemberOfOrganization]] = Field(None, alias='member-of-organizations')
    remarks: Optional[Remarks] = None


class Part(OscalBaseModel):
    """
    A partition of a control's definition or a child of another part.
    """

    class Config:
        extra = Extra.forbid

    id: Optional[constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    )] = Field(
        None,
        description=
        'A human-oriented, locally unique identifier with cross-instance scope that can be used to reference this defined part elsewhere in this or other OSCAL instances. When referenced from another OSCAL instance, this identifier must be referenced in the context of the containing resource (e.g., import-profile). This id should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Part Identifier',
    )
    name: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description="A textual label that uniquely identifies the part's semantic type.",
        title='Part Name',
    )
    ns: Optional[AnyUrl] = Field(
        None,
        description=
        "A namespace qualifying the part's name. This allows different organizations to associate distinct semantics with the same name.",
        title='Part Namespace',
    )
    class_: Optional[constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    )] = Field(
        None,
        alias='class',
        description=
        "A textual label that provides a sub-type or characterization of the part's name. This can be used to further distinguish or discriminate between the semantics of multiple parts of the same control with the same name and ns.",
        title='Part Class',
    )
    title: Optional[str] = Field(
        None,
        description='A name given to the part, which may be used by a tool for display and navigation.',
        title='Part Title',
    )
    props: Optional[List[Property]] = Field(None)
    prose: Optional[str] = Field(
        None,
        description='Permits multiple paragraphs, lists, tables etc.',
        title='Part Text',
    )
    parts: Optional[List[Part]] = None
    links: Optional[List[Link]] = Field(None)


class LocalObjective(OscalBaseModel):
    """
    A local definition of a control objective for this assessment. Uses catalog syntax for control objective and assessment actions.
    """

    class Config:
        extra = Extra.forbid

    control_id: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        alias='control-id',
        description=
        'A human-oriented identifier reference to a control with a corresponding id value. When referencing an externally defined control, the Control Identifier Reference must be used in the context of the external / imported OSCAL instance (e.g., uri-reference).',
        title='Control Identifier Reference',
    )
    description: Optional[str] = Field(
        None,
        description='A human-readable description of this control objective.',
        title='Objective Description',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    parts: List[Part] = Field(...)
    remarks: Optional[Remarks] = None


class ParameterSelection(OscalBaseModel):
    """
    Presenting a choice among alternatives
    """

    class Config:
        extra = Extra.forbid

    how_many: Optional[HowMany] = Field(
        None,
        alias='how-many',
        description=
        'Describes the number of selections that must occur. Without this setting, only one value should be assumed to be permitted.',
        title='Parameter Cardinality',
    )
    choice: Optional[List[str]] = Field(None)


class Parameter(OscalBaseModel):
    """
    Parameters provide a mechanism for the dynamic assignment of value(s) in a control.
    """

    class Config:
        extra = Extra.forbid

    id: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(
        ...,
        description=
        'A human-oriented, locally unique identifier with cross-instance scope that can be used to reference this defined parameter elsewhere in this or other OSCAL instances. When referenced from another OSCAL instance, this identifier must be referenced in the context of the containing resource (e.g., import-profile). This id should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Parameter Identifier',
    )
    class_: Optional[constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    )] = Field(
        None,
        alias='class',
        description='A textual label that provides a characterization of the parameter.',
        title='Parameter Class',
    )
    depends_on: Optional[constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    )] = Field(
        None,
        alias='depends-on',
        description=
        '**(deprecated)** Another parameter invoking this one. This construct has been deprecated and should not be used.',
        title='Depends on',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    label: Optional[str] = Field(
        None,
        description=
        'A short, placeholder name for the parameter, which can be used as a substitute for a value if no value is assigned.',
        title='Parameter Label',
    )
    usage: Optional[str] = Field(
        None,
        description='Describes the purpose and use of a parameter',
        title='Parameter Usage Description',
    )
    constraints: Optional[List[ParameterConstraint]] = Field(None)
    guidelines: Optional[List[ParameterGuideline]] = Field(None)
    values: Optional[List[ParameterValue]] = Field(None)
    select: Optional[ParameterSelection] = None
    remarks: Optional[Remarks] = None


class OriginActor(OscalBaseModel):
    """
    The actor that produces an observation, a finding, or a risk. One or more actor type can be used to specify a person that is using a tool.
    """

    class Config:
        extra = Extra.forbid

    type: Type3 = Field(..., description='The kind of actor.', title='Actor Type')
    actor_uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        alias='actor-uuid',
        description='A machine-oriented identifier reference to the tool or person based on the associated type.',
        title='Actor Universally Unique Identifier Reference',
    )
    role_id: Optional[constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    )] = Field(
        None,
        alias='role-id',
        description='For a party, this can optionally be used to specify the role the actor was performing.',
        title='Actor Role',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)


class Location(OscalBaseModel):
    """
    A location, with associated metadata that can be referenced.
    """

    class Config:
        extra = Extra.forbid

    uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this defined location elsewhere in this or other OSCAL instances. The locally defined UUID of the location can be used to reference the data item locally or globally (e.g., from an importing OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Location Universally Unique Identifier',
    )
    title: Optional[str] = Field(
        None,
        description='A name given to the location, which may be used by a tool for display and navigation.',
        title='Location Title',
    )
    address: Address
    email_addresses: Optional[List[EmailAddress]] = Field(None, alias='email-addresses')
    telephone_numbers: Optional[List[TelephoneNumber]] = Field(None, alias='telephone-numbers')
    urls: Optional[List[AnyUrl]] = Field(None)
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    remarks: Optional[Remarks] = None


class Metadata(OscalBaseModel):
    """
    Provides information about the publication and availability of the containing document.
    """

    class Config:
        extra = Extra.forbid

    title: str = Field(
        ...,
        description='A name given to the document, which may be used by a tool for display and navigation.',
        title='Document Title',
    )
    published: Optional[Published] = None
    last_modified: LastModified = Field(..., alias='last-modified')
    version: Version
    oscal_version: OscalVersion = Field(..., alias='oscal-version')
    revisions: Optional[List[Revision]] = Field(None)
    document_ids: Optional[List[DocumentId]] = Field(None, alias='document-ids')
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    roles: Optional[List[Role]] = Field(None)
    locations: Optional[List[Location]] = Field(None)
    parties: Optional[List[Party]] = Field(None)
    responsible_parties: Optional[List[ResponsibleParty]] = Field(None, alias='responsible-parties')
    remarks: Optional[Remarks] = None


class ImplementedComponent(OscalBaseModel):
    """
    The set of components that are implemented in a given system inventory item.
    """

    class Config:
        extra = Extra.forbid

    component_uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        alias='component-uuid',
        description=
        'A machine-oriented identifier reference to a component that is implemented as part of an inventory item.',
        title='Component Universally Unique Identifier Reference',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    responsible_parties: Optional[List[ResponsibleParty]] = Field(None, alias='responsible-parties')
    remarks: Optional[Remarks] = None


class InventoryItem(OscalBaseModel):
    """
    A single managed inventory item within the system.
    """

    class Config:
        extra = Extra.forbid

    uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this inventory item elsewhere in this or other OSCAL instances. The locally defined UUID of the inventory item can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Inventory Item Universally Unique Identifier',
    )
    description: str = Field(
        ...,
        description='A summary of the inventory item stating its purpose within the system.',
        title='Inventory Item Description',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    responsible_parties: Optional[List[ResponsibleParty]] = Field(None, alias='responsible-parties')
    implemented_components: Optional[List[ImplementedComponent]] = Field(None, alias='implemented-components')
    remarks: Optional[Remarks] = None


class IdentifiedSubject(OscalBaseModel):
    """
    Used to detail assessment subjects that were identfied by this task.
    """

    class Config:
        extra = Extra.forbid

    subject_placeholder_uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        alias='subject-placeholder-uuid',
        description=
        'A machine-oriented identifier reference to a unique assessment subject placeholder defined by this task.',
        title='Assessment Subject Placeholder Universally Unique Identifier Reference',
    )
    subjects: List[AssessmentSubject] = Field(...)


class RelatedTask(OscalBaseModel):
    """
    Identifies an individual task for which the containing object is a consequence of.
    """

    class Config:
        extra = Extra.forbid

    task_uuid: constr(regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
                      ) = Field(
                          ...,
                          alias='task-uuid',
                          description='A machine-oriented identifier reference to a unique task.',
                          title='Task Universally Unique Identifier Reference',
                      )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    responsible_parties: Optional[List[ResponsibleParty]] = Field(None, alias='responsible-parties')
    subjects: Optional[List[AssessmentSubject]] = Field(None)
    identified_subject: Optional[IdentifiedSubject] = Field(
        None,
        alias='identified-subject',
        description='Used to detail assessment subjects that were identfied by this task.',
        title='Identified Subject',
    )
    remarks: Optional[Remarks] = None


class RelatedResponse(OscalBaseModel):
    """
    Identifies an individual risk response that this log entry is for.
    """

    class Config:
        extra = Extra.forbid

    response_uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        alias='response-uuid',
        description='A machine-oriented identifier reference to a unique risk response.',
        title='Response Universally Unique Identifier Reference',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    related_tasks: Optional[List[RelatedTask]] = Field(None, alias='related-tasks')
    remarks: Optional[Remarks] = None


class AssociatedActivity(OscalBaseModel):
    """
    Identifies an individual activity to be performed as part of a task.
    """

    class Config:
        extra = Extra.forbid

    activity_uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        alias='activity-uuid',
        description='A machine-oriented identifier reference to an activity defined in the list of activities.',
        title='Activity Universally Unique Identifier Reference',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    responsible_roles: Optional[List[ResponsibleRole]] = Field(None, alias='responsible-roles')
    subjects: List[AssessmentSubject] = Field(...)
    remarks: Optional[Remarks] = None


class Task(OscalBaseModel):
    """
    Represents a scheduled event or milestone, which may be associated with a series of assessment actions.
    """

    class Config:
        extra = Extra.forbid

    uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this task elsewhere in this or other OSCAL instances. The locally defined UUID of the task can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Task Universally Unique Identifier',
    )
    type: constr(
        regex=
        r'^[_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-\.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$'
    ) = Field(..., description='The type of task.', title='Task Type')
    title: str = Field(..., description='The title for this task.', title='Task Title')
    description: Optional[str] = Field(
        None,
        description='A human-readable description of this task.',
        title='Task Description',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    timing: Optional[Timing] = Field(
        None,
        description='The timing under which the task is intended to occur.',
        title='Event Timing',
    )
    dependencies: Optional[List[Dependency]] = Field(None)
    tasks: Optional[List[Task]] = None
    associated_activities: Optional[List[AssociatedActivity]] = Field(None, alias='associated-activities')
    subjects: Optional[List[AssessmentSubject]] = Field(None)
    responsible_roles: Optional[List[ResponsibleRole]] = Field(None, alias='responsible-roles')
    remarks: Optional[Remarks] = None


class UsesComponent(OscalBaseModel):
    """
    The set of components that are used by the assessment platform.
    """

    class Config:
        extra = Extra.forbid

    component_uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        alias='component-uuid',
        description=
        'A machine-oriented identifier reference to a component that is implemented as part of an inventory item.',
        title='Component Universally Unique Identifier Reference',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    responsible_parties: Optional[List[ResponsibleParty]] = Field(None, alias='responsible-parties')
    remarks: Optional[Remarks] = None


class AssessmentPlatform(OscalBaseModel):
    """
    Used to represent the toolset used to perform aspects of the assessment.
    """

    class Config:
        extra = Extra.forbid

    uuid: constr(
        regex=r'^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}$'
    ) = Field(
        ...,
        description=
        'A machine-oriented, globally unique identifier with cross-instance scope that can be used to reference this assessment platform elsewhere in this or other OSCAL instances. The locally defined UUID of the assessment platform can be used to reference the data item locally or globally (e.g., in an imported OSCAL instance). This UUID should be assigned per-subject, which means it should be consistently used to identify the same subject across revisions of the document.',
        title='Assessment Platform Universally Unique Identifier',
    )
    title: Optional[str] = Field(
        None,
        description='The title or name for the assessment platform.',
        title='Assessment Platform Title',
    )
    props: Optional[List[Property]] = Field(None)
    links: Optional[List[Link]] = Field(None)
    uses_components: Optional[List[UsesComponent]] = Field(None, alias='uses-components')
    remarks: Optional[Remarks] = None


AssessmentPart.update_forward_refs()
Part.update_forward_refs()
Task.update_forward_refs()
