|
| 1 | +from __future__ import annotations |
| 2 | + |
| 3 | +from enum import Enum |
| 4 | +from typing import List, Optional, Union |
| 5 | + |
| 6 | +from pydantic import AnyUrl, AwareDatetime, BaseModel, Field, constr |
| 7 | + |
| 8 | + |
| 9 | +class Result(Enum): |
| 10 | + ok = 'ok' |
| 11 | + aborted = 'aborted' |
| 12 | + |
| 13 | + |
| 14 | +class Status(Enum): |
| 15 | + cancelled = 'cancelled' |
| 16 | + finished = 'finished' |
| 17 | + ongoing = 'ongoing' |
| 18 | + planned = 'planned' |
| 19 | + scheduled = 'scheduled' |
| 20 | + |
| 21 | + |
| 22 | +class Type(Enum): |
| 23 | + BuildingOperation = 'BuildingOperation' |
| 24 | + |
| 25 | + |
| 26 | +class BuildingOperation(BaseModel): |
| 27 | + alternateName: Optional[str] = Field( |
| 28 | + None, description='An alternative name for this item' |
| 29 | + ) |
| 30 | + dataProvider: Optional[str] = Field( |
| 31 | + None, |
| 32 | + description='A sequence of characters identifying the provider of the harmonised data entity', |
| 33 | + ) |
| 34 | + dateCreated: Optional[AwareDatetime] = Field( |
| 35 | + None, |
| 36 | + description='Entity creation timestamp. This will usually be allocated by the storage platform', |
| 37 | + ) |
| 38 | + dateFinished: Optional[AwareDatetime] = Field( |
| 39 | + None, description='The actual end date for the operation' |
| 40 | + ) |
| 41 | + dateModified: Optional[AwareDatetime] = Field( |
| 42 | + None, |
| 43 | + description='Timestamp of the last modification of the entity. This will usually be allocated by the storage platform', |
| 44 | + ) |
| 45 | + dateStarted: Optional[AwareDatetime] = Field( |
| 46 | + None, description='The actual start date for the operation' |
| 47 | + ) |
| 48 | + description: Optional[str] = Field(None, description='A description of this item') |
| 49 | + endDate: Optional[AwareDatetime] = Field( |
| 50 | + None, description='The planned end date for the operation' |
| 51 | + ) |
| 52 | + id: Optional[ |
| 53 | + Union[ |
| 54 | + constr( |
| 55 | + pattern=r'^[\\w\\-\\.\\{\\}\\$\\+\\*\\[\\]`|~^@!, :\\\\]+$', |
| 56 | + min_length=1, |
| 57 | + max_length=256, |
| 58 | + ), |
| 59 | + AnyUrl, |
| 60 | + ] |
| 61 | + ] = Field(None, description='Unique identifier of the entity') |
| 62 | + name: Optional[str] = Field(None, description='The name of this item') |
| 63 | + operationSequence: Optional[List[str]] = Field( |
| 64 | + None, description='Id of the sequence of the operation when available' |
| 65 | + ) |
| 66 | + operationType: Optional[str] = Field( |
| 67 | + None, description='Type of the operation on the building' |
| 68 | + ) |
| 69 | + owner: Optional[ |
| 70 | + List[ |
| 71 | + Union[ |
| 72 | + constr( |
| 73 | + pattern=r'^[\\w\\-\\.\\{\\}\\$\\+\\*\\[\\]`|~^@!,:\\\\]+$', |
| 74 | + min_length=1, |
| 75 | + max_length=256, |
| 76 | + ), |
| 77 | + AnyUrl, |
| 78 | + ] |
| 79 | + ] |
| 80 | + ] = Field( |
| 81 | + None, |
| 82 | + description='A List containing a JSON encoded sequence of characters referencing the unique Ids of the owner(s)', |
| 83 | + ) |
| 84 | + refBuilding: Optional[ |
| 85 | + Union[ |
| 86 | + constr( |
| 87 | + pattern=r'^[\\w\\-\\.\\{\\}\\$\\+\\*\\[\\]`|~^@!, :\\\\]+$', |
| 88 | + min_length=1, |
| 89 | + max_length=256, |
| 90 | + ), |
| 91 | + AnyUrl, |
| 92 | + ] |
| 93 | + ] = Field(None, description='Building reference where the operation is performed') |
| 94 | + refOperator: Optional[ |
| 95 | + Union[ |
| 96 | + constr( |
| 97 | + pattern=r'^[\\w\\-\\.\\{\\}\\$\\+\\*\\[\\]`|~^@!, :\\\\]+$', |
| 98 | + min_length=1, |
| 99 | + max_length=256, |
| 100 | + ), |
| 101 | + AnyUrl, |
| 102 | + ] |
| 103 | + ] = Field( |
| 104 | + None, |
| 105 | + description='Reference to the Operator doing the operation on the building', |
| 106 | + ) |
| 107 | + refRelatedBuildingOperation: Optional[ |
| 108 | + List[ |
| 109 | + Union[ |
| 110 | + constr( |
| 111 | + pattern=r'^[\\w\\-\\.\\{\\}\\$\\+\\*\\[\\]`|~^@!,:\\\\]+$', |
| 112 | + min_length=1, |
| 113 | + max_length=256, |
| 114 | + ), |
| 115 | + AnyUrl, |
| 116 | + ] |
| 117 | + ] |
| 118 | + ] = Field( |
| 119 | + None, description='Reference to other building operations when in sequence' |
| 120 | + ) |
| 121 | + refRelatedDeviceOperation: Optional[ |
| 122 | + List[ |
| 123 | + Union[ |
| 124 | + constr( |
| 125 | + pattern=r'^[\\w\\-\\.\\{\\}\\$\\+\\*\\[\\]`|~^@!,:\\\\]+$', |
| 126 | + min_length=1, |
| 127 | + max_length=256, |
| 128 | + ), |
| 129 | + AnyUrl, |
| 130 | + ] |
| 131 | + ] |
| 132 | + ] = Field( |
| 133 | + None, |
| 134 | + description='Devices related to the current operation. A list of references to an entity of type Device', |
| 135 | + ) |
| 136 | + result: Optional[Result] = Field( |
| 137 | + None, description="Result of the building operation. Enum:'ok, aborted'" |
| 138 | + ) |
| 139 | + seeAlso: Optional[Union[List[AnyUrl], AnyUrl]] = Field( |
| 140 | + None, description='list of uri pointing to additional resources about the item' |
| 141 | + ) |
| 142 | + source: Optional[str] = Field( |
| 143 | + None, |
| 144 | + description='A sequence of characters giving the original source of the entity data as a URL. Recommended to be the fully qualified domain name of the source provider, or the URL to the source object', |
| 145 | + ) |
| 146 | + startDate: Optional[AwareDatetime] = Field( |
| 147 | + None, description='The planned start date for the operation' |
| 148 | + ) |
| 149 | + status: Optional[Status] = Field( |
| 150 | + None, |
| 151 | + description="Status of the operation. Enum:'cancelled, finished, ongoing, planned, scheduled' ", |
| 152 | + ) |
| 153 | + type: Optional[Type] = Field(None, description='It has to be BuildingOperation') |
0 commit comments