# generated by datamodel-codegen:
#   filename:  oscal_assessment-plan_schema.json

from __future__ import annotations

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

from pydantic import AnyUrl, EmailStr, Field, conint, constr
from trestle.core.base_model import OscalBaseModel


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='References a location defined in metadata.')


class Type(Enum):
    person = 'person'
    organization = 'organization'


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


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='Identifies that the party object is a member of the organization associated with the provided UUID.',
    )


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='References a party defined in metadata.')


class RoleId(OscalBaseModel):
    __root__: str = Field(
        ..., description='A reference to the roles served by the user.'
    )


class Base64(OscalBaseModel):
    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[str] = 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 Link(OscalBaseModel):
    href: str = Field(
        ...,
        description='A resolvable URL reference to a resource.',
        title='Hypertext Reference',
    )
    rel: Optional[str] = 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[str] = 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 Hash(OscalBaseModel):
    algorithm: str = Field(
        ..., description='Method by which a hash is derived', title='Hash algorithm'
    )
    value: str


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


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.',
    )


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.',
    )


class Version(OscalBaseModel):
    __root__: str = Field(
        ...,
        description='A string used to distinguish the current version of the document from other previous (and future) versions.',
    )


class OscalVersion(OscalBaseModel):
    __root__: str = Field(
        ..., description='The OSCAL model version the document was authored against.'
    )


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


class TelephoneNumber(OscalBaseModel):
    type: Optional[str] = Field(
        None, description='Indicates the type of phone number.', title='type flag'
    )
    number: str


class AddrLine(OscalBaseModel):
    __root__: str = Field(..., description='A single line of an address.')


class DocumentId(OscalBaseModel):
    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 State(Enum):
    under_development = 'under-development'
    operational = 'operational'
    disposition = 'disposition'
    other = 'other'


class Status(OscalBaseModel):
    state: State = Field(..., description='The operational status.', title='State')
    remarks: Optional[Remarks] = None


class Transport(Enum):
    TCP = 'TCP'
    UDP = 'UDP'


class PortRange(OscalBaseModel):
    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 FunctionPerformed(OscalBaseModel):
    __root__: str = Field(
        ...,
        description='Describes a function performed for a given authorized privilege by this user class.',
    )


class ImportSsp(OscalBaseModel):
    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 OnDate(OscalBaseModel):
    date: datetime = Field(
        ...,
        description='The task must occur on the specified date.',
        title='On Date Condition',
    )


class WithinDateRange(OscalBaseModel):
    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 Unit(Enum):
    seconds = 'seconds'
    minutes = 'minutes'
    hours = 'hours'
    days = 'days'
    months = 'months'
    years = 'years'


class AtFrequency(OscalBaseModel):
    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 Timing(OscalBaseModel):
    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 Dependency(OscalBaseModel):
    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='References a unique task by UUID.',
        title='Task Universally Unique Identifier Reference',
    )
    remarks: Optional[Remarks] = None


class SelectControlById(OscalBaseModel):
    control_id: str = Field(
        ...,
        alias='control-id',
        description='A reference to a control identifier.',
        title='Control Identifier Reference',
    )
    statement_ids: Optional[List[str]] = Field(None, alias='statement-ids', min_items=1)


class SelectObjectiveById(OscalBaseModel):
    objective_id: str = Field(
        ...,
        alias='objective-id',
        description='Points to an assessment objective.',
        title='Objective ID',
    )


class Source(OscalBaseModel):
    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='Uniquely identifies an assessment activity to be performed as part of the event. This UUID may be referenced elsewhere in an OSCAL document when referring to this information. A UUID should be consistently used for this schedule across revisions of the document.',
        title='Task Universally Unique Identifier',
    )


class OscalAssessmentCommonSelectControlById(OscalBaseModel):
    __root__: Any


class Rlink(OscalBaseModel):
    href: str = Field(
        ...,
        description='A resolvable URI reference to a resource.',
        title='Hypertext Reference',
    )
    media_type: Optional[str] = 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, min_items=1)


class Property(OscalBaseModel):
    name: str = 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 unique identifier that can be used to reference this property elsewhere in an OSCAL document. A UUID should be consistantly used for a given location 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: str = Field(
        ...,
        description='Indicates the value of the attribute, characteristic, or quality.',
        title='Property Value',
    )
    class_: Optional[str] = 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 ResponsibleParty(OscalBaseModel):
    party_uuids: List[PartyUuid] = Field(..., alias='party-uuids', min_items=1)
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    remarks: Optional[Remarks] = None


class ResponsibleRole(OscalBaseModel):
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    party_uuids: Optional[List[PartyUuid]] = Field(
        None, alias='party-uuids', min_items=1
    )
    remarks: Optional[Remarks] = None


class Address(OscalBaseModel):
    type: Optional[str] = Field(
        None, description='Indicates the type of address.', title='Address Type'
    )
    addr_lines: Optional[List[AddrLine]] = Field(None, alias='addr-lines', min_items=1)
    city: Optional[str] = Field(
        None,
        description='City, town or geographical region for the mailing address.',
        title='City',
    )
    state: Optional[str] = Field(
        None,
        description='State, province or analogous geographical region for mailing address',
        title='State',
    )
    postal_code: Optional[str] = Field(
        None,
        alias='postal-code',
        description='Postal or ZIP code for mailing address',
        title='Postal Code',
    )
    country: Optional[str] = Field(
        None,
        description='The ISO 3166-1 alpha-2 country code for the mailing address.',
        title='Country Code',
    )


class Protocol(OscalBaseModel):
    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 globally unique identifier that can be used to reference this service protocol entry elsewhere in an OSCAL document. A UUID should be consistently used for a given resource across revisions of the document.',
        title='Service Protocol Information Universally Unique Identifier',
    )
    name: str = 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', min_items=1
    )


class AuthorizedPrivilege(OscalBaseModel):
    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', min_items=1
    )


class ImplementedComponent(OscalBaseModel):
    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 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, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    responsible_parties: Optional[Dict[str, ResponsibleParty]] = Field(
        None, alias='responsible-parties'
    )
    remarks: Optional[Remarks] = None


class InventoryItem(OscalBaseModel):
    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 globally unique identifier that can be used to reference this inventory item entry elsewhere in an OSCAL document. A UUID should be consistently used for a given resource 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, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    responsible_parties: Optional[Dict[str, ResponsibleParty]] = Field(
        None, alias='responsible-parties'
    )
    implemented_components: Optional[List[ImplementedComponent]] = Field(
        None, alias='implemented-components', min_items=1
    )
    remarks: Optional[Remarks] = None


class ControlSelection(OscalBaseModel):
    description: Optional[str] = Field(
        None,
        description='A human-readable description of in-scope controls specified for assessment.',
        title='Assessed Controls Description',
    )
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    include_all: Optional[Dict[str, Any]] = Field(
        None,
        alias='include-all',
        description='A key word to indicate all.',
        title='All',
    )
    include_controls: Optional[List[OscalAssessmentCommonSelectControlById]] = Field(
        None, alias='include-controls', min_items=1
    )
    exclude_controls: Optional[List[OscalAssessmentCommonSelectControlById]] = Field(
        None, alias='exclude-controls', min_items=1
    )
    remarks: Optional[Remarks] = None


class ControlObjectiveSelection(OscalBaseModel):
    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, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    include_all: Optional[Dict[str, Any]] = Field(
        None,
        alias='include-all',
        description='A key word to indicate all.',
        title='All',
    )
    include_objectives: Optional[List[SelectObjectiveById]] = Field(
        None, alias='include-objectives', min_items=1
    )
    exclude_objectives: Optional[List[SelectObjectiveById]] = Field(
        None, alias='exclude-objectives', min_items=1
    )
    remarks: Optional[Remarks] = None


class ReviewedControls(OscalBaseModel):
    description: Optional[str] = Field(
        None,
        description='A human-readable description of control objectives.',
        title='Control Objective Description',
    )
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    control_selections: List[ControlSelection] = Field(
        ..., alias='control-selections', min_items=1
    )
    control_objective_selections: Optional[List[ControlObjectiveSelection]] = Field(
        None, alias='control-objective-selections', min_items=1
    )
    remarks: Optional[Remarks] = None


class AssessmentSubjectPlaceholder(OscalBaseModel):
    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='Uniquely identifies a set of assessment subjects that will be identified by a task or an activity that is part of a task.',
        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(..., min_items=1)
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    remarks: Optional[Remarks] = None


class SelectSubjectById(OscalBaseModel):
    uuid_ref: 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='uuid-ref',
        description="A pointer to a component, inventory-item, location, party, user, or resource using it's UUID.",
        title='UUID Reference',
    )
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    remarks: Optional[Remarks] = None


class UsesComponent(OscalBaseModel):
    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 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, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    responsible_parties: Optional[Dict[str, ResponsibleParty]] = Field(
        None, alias='responsible-parties'
    )
    remarks: Optional[Remarks] = None


class AssessmentPlatform(OscalBaseModel):
    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='Uniquely identifies this assessment Platform.',
        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, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    uses_components: Optional[List[UsesComponent]] = Field(
        None, alias='uses-components', min_items=1
    )
    remarks: Optional[Remarks] = None


class AssessmentPart(OscalBaseModel):
    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 unique identifier for a specific part instance. This identifier's uniqueness is document scoped and is intended to be consistent for the same part across minor revisions of the document.",
        title='Part Identifier',
    )
    name: str = 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[str] = 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, min_items=1)
    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, min_items=1)


class TermsAndConditions(OscalBaseModel):
    parts: Optional[List[AssessmentPart]] = Field(None, min_items=1)


class Part(OscalBaseModel):
    id: Optional[str] = Field(
        None,
        description="A unique identifier for a specific part instance. This identifier's uniqueness is document scoped and is intended to be consistent for the same part across minor revisions of the document.",
        title='Part Identifier',
    )
    name: str = 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[str] = 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, min_items=1)
    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, min_items=1)


class Revision(OscalBaseModel):
    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: Optional[Version] = None
    oscal_version: Optional[OscalVersion] = Field(None, alias='oscal-version')
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    remarks: Optional[Remarks] = None


class Location(OscalBaseModel):
    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 unique identifier that can be used to reference this defined location elsewhere in an OSCAL document. A UUID should be consistently used for a given location 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', min_items=1
    )
    telephone_numbers: Optional[List[TelephoneNumber]] = Field(
        None, alias='telephone-numbers', min_items=1
    )
    urls: Optional[List[AnyUrl]] = Field(None, min_items=1)
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    remarks: Optional[Remarks] = None


class Party(OscalBaseModel):
    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 unique identifier that can be used to reference this defined location elsewhere in an OSCAL document. A UUID should be consistantly used for a given party 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[str] = 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[str] = 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', min_items=1
    )
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    email_addresses: Optional[List[EmailAddress]] = Field(
        None, alias='email-addresses', min_items=1
    )
    telephone_numbers: Optional[List[TelephoneNumber]] = Field(
        None, alias='telephone-numbers', min_items=1
    )
    addresses: Optional[List[Address]] = Field(None, min_items=1)
    location_uuids: Optional[List[LocationUuid]] = Field(
        None, alias='location-uuids', min_items=1
    )
    member_of_organizations: Optional[List[MemberOfOrganization]] = Field(
        None, alias='member-of-organizations', min_items=1
    )
    remarks: Optional[Remarks] = None


class Role(OscalBaseModel):
    id: str = Field(
        ...,
        description="A unique identifier for a specific role instance. This identifier's uniqueness is document scoped and is intended to be consistent for the same role across minor 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[str] = 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, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    remarks: Optional[Remarks] = None


class Citation(OscalBaseModel):
    text: str = Field(
        ..., description='A line of citation text.', title='Citation Text'
    )
    props: Optional[List[Property]] = Field(None, min_items=1)
    biblio: Optional[Dict[str, Any]] = Field(
        None,
        description='A container for structured bibliographic information. The model of this information is undefined by OSCAL.',
        title='Bibliographic Definition',
    )


class Resource(OscalBaseModel):
    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 globally unique identifier that can be used to reference this defined resource elsewhere in an OSCAL document. A UUID should be consistently used for a given resource 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, min_items=1)
    document_ids: Optional[List[DocumentId]] = Field(
        None, alias='document-ids', min_items=1
    )
    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, min_items=1)
    base64: Optional[Base64] = Field(
        None,
        description='The Base64 alphabet in RFC 2045 - aligned with XSD.',
        title='Base64',
    )
    remarks: Optional[Remarks] = None


class BackMatter(OscalBaseModel):
    resources: Optional[List[Resource]] = Field(None, min_items=1)


class SystemComponent(OscalBaseModel):
    type: str = Field(
        ...,
        description='A category describing the purpose of the component.',
        title='Component Type',
    )
    title: str = Field(
        ...,
        description='A human readable name for the system component.',
        title='Component Title',
    )
    description: str = Field(
        ...,
        description='A description of the component, including information about its function.',
        title='Component Description',
    )
    purpose: Optional[str] = Field(
        None,
        description='A summary of the technological or business purpose of the component.',
        title='Purpose',
    )
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    status: Status = Field(
        ...,
        description='Describes the operational status of the system component.',
        title='Status',
    )
    responsible_roles: Optional[Dict[str, ResponsibleRole]] = Field(
        None, alias='responsible-roles'
    )
    protocols: Optional[List[Protocol]] = Field(None, min_items=1)
    remarks: Optional[Remarks] = None


class SystemUser(OscalBaseModel):
    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[str] = 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, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    role_ids: Optional[List[RoleId]] = Field(None, alias='role-ids', min_items=1)
    authorized_privileges: Optional[List[AuthorizedPrivilege]] = Field(
        None, alias='authorized-privileges', min_items=1
    )
    remarks: Optional[Remarks] = None


class LocalObjective(OscalBaseModel):
    control_id: str = Field(
        ...,
        alias='control-id',
        description='A reference to a control identifier.',
        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, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    parts: List[Part] = Field(..., min_items=1)
    remarks: Optional[Remarks] = None


class Step(OscalBaseModel):
    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='Uniquely identifies a step. This UUID may be referenced elsewhere in an OSCAL document when referring to this step. A UUID should be consistently used for a given test step across revisions of the document.',
        title='Step Universally Unique Identifier',
    )
    title: Optional[str] = Field(
        None, description='The title for this step.', title='Step Title'
    )
    description: str = Field(
        ...,
        description='A human-readable description of this step.',
        title='Step Description',
    )
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    reviewed_controls: Optional[ReviewedControls] = Field(
        None, alias='reviewed-controls'
    )
    responsible_roles: Optional[Dict[str, ResponsibleRole]] = Field(
        None, alias='responsible-roles'
    )
    remarks: Optional[Remarks] = None


class Activity(OscalBaseModel):
    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='Uniquely identifies this assessment activity. This UUID may be referenced elsewhere in an OSCAL document when referring to this information. A UUID should be consistently used for a given included activity across revisions of the document.',
        title='Assessment Activity Universally Unique Identifier',
    )
    title: Optional[str] = Field(
        None,
        description='The title for this included activity.',
        title='Included Activity Title',
    )
    description: str = Field(
        ...,
        description='A human-readable description of this included activity.',
        title='Included Activity Description',
    )
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    steps: Optional[List[Step]] = Field(None, min_items=1)
    related_controls: Optional[ReviewedControls] = Field(None, alias='related-controls')
    responsible_roles: Optional[Dict[str, ResponsibleRole]] = Field(
        None, alias='responsible-roles'
    )
    remarks: Optional[Remarks] = None


class AssessmentSubject(OscalBaseModel):
    type: str = 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, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    include_all: Optional[Dict[str, Any]] = Field(
        None,
        alias='include-all',
        description='A key word to indicate all.',
        title='All',
    )
    include_subjects: Optional[List[SelectSubjectById]] = Field(
        None, alias='include-subjects', min_items=1
    )
    exclude_subjects: Optional[List[SelectSubjectById]] = Field(
        None, alias='exclude-subjects', min_items=1
    )
    remarks: Optional[Remarks] = None


class AssessmentAssets(OscalBaseModel):
    components: Optional[Dict[str, SystemComponent]] = None
    assessment_platforms: List[AssessmentPlatform] = Field(
        ..., alias='assessment-platforms', min_items=1
    )


class LocalDefinitions(OscalBaseModel):
    components: Optional[Dict[str, SystemComponent]] = None
    inventory_items: Optional[List[InventoryItem]] = Field(
        None, alias='inventory-items', min_items=1
    )
    users: Optional[Dict[str, SystemUser]] = None
    objectives_and_methods: Optional[List[LocalObjective]] = Field(
        None, alias='objectives-and-methods', min_items=1
    )
    activities: Optional[List[Activity]] = Field(None, min_items=1)
    remarks: Optional[Remarks] = None


class Metadata(OscalBaseModel):
    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, min_items=1)
    document_ids: Optional[List[DocumentId]] = Field(
        None, alias='document-ids', min_items=1
    )
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    roles: Optional[List[Role]] = Field(None, min_items=1)
    locations: Optional[List[Location]] = Field(None, min_items=1)
    parties: Optional[List[Party]] = Field(None, min_items=1)
    responsible_parties: Optional[Dict[str, ResponsibleParty]] = Field(
        None, alias='responsible-parties'
    )
    remarks: Optional[Remarks] = None


class AssociatedActivity(OscalBaseModel):
    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='References an activity defined in the list of activities.',
        title='Activity Universally Unique Identifier Reference',
    )
    props: Optional[List[Property]] = Field(None, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    responsible_roles: Optional[Dict[str, ResponsibleRole]] = Field(
        None, alias='responsible-roles'
    )
    subjects: Optional[List[AssessmentSubject]] = Field(None, min_items=1)
    subject_placeholder: Optional[AssessmentSubjectPlaceholder] = Field(
        None, alias='subject-placeholder'
    )
    remarks: Optional[Remarks] = None


class Task(OscalBaseModel):
    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='Uniquely identifies this assessment task.',
        title='Task Universally Unique Identifier',
    )
    type: str = 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, min_items=1)
    links: Optional[List[Link]] = Field(None, min_items=1)
    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, min_items=1)
    tasks: Optional[List[Task]] = None
    associated_activities: Optional[List[AssociatedActivity]] = Field(
        None, alias='associated-activities', min_items=1
    )
    subjects: Optional[List[AssessmentSubject]] = Field(None, min_items=1)
    responsible_roles: Optional[Dict[str, ResponsibleRole]] = Field(
        None, alias='responsible-roles'
    )
    remarks: Optional[Remarks] = None


class AssessmentPlan(OscalBaseModel):
    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='Uniquely identifies this assessment plan. This UUID must be changed each time the content of the plan changes.',
        title='Assessment Plan Universally Unique Identifier',
    )
    metadata: Metadata
    import_ssp: ImportSsp = Field(..., alias='import-ssp')
    local_definitions: Optional[LocalDefinitions] = Field(
        None,
        alias='local-definitions',
        description='Used to define data objects that are used in the assessment plan, that do not appear in the referenced SSP.',
        title='Local Definitions',
    )
    terms_and_conditions: Optional[TermsAndConditions] = Field(
        None,
        alias='terms-and-conditions',
        description='Used to define various terms and conditions under which an assessment, described by the plan, can be performed. Each child part defines a different type of term or condition.',
        title='Assessment Plan Terms and Conditions',
    )
    reviewed_controls: ReviewedControls = Field(..., alias='reviewed-controls')
    assessment_subjects: Optional[List[AssessmentSubject]] = Field(
        None, alias='assessment-subjects', min_items=1
    )
    assessment_assets: Optional[AssessmentAssets] = Field(
        None, alias='assessment-assets'
    )
    tasks: Optional[List[Task]] = Field(None, min_items=1)
    back_matter: Optional[BackMatter] = Field(None, alias='back-matter')


class Model(OscalBaseModel):
    assessment_plan: AssessmentPlan = Field(..., alias='assessment-plan')


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