76 lines
1.5 KiB
Python
Executable File
76 lines
1.5 KiB
Python
Executable File
from dataclasses import dataclass
|
|
from datetime import date
|
|
from typing import Optional, List
|
|
|
|
|
|
class Enterprise:
|
|
def __init__(
|
|
self,
|
|
_id: Optional[int],
|
|
activities: List['Activity'],
|
|
divisions: List['Division'],
|
|
contact_info: 'ContactInfo',
|
|
name: str,
|
|
short_name: str
|
|
|
|
):
|
|
self.id = _id
|
|
self.activities = activities
|
|
self.divisions = divisions
|
|
self.contact_info = contact_info
|
|
self.name = name
|
|
self.short_name = short_name
|
|
|
|
|
|
@dataclass
|
|
class PhoneNumber:
|
|
id: Optional[int]
|
|
date_of_start: date
|
|
date_of_end: Optional[date]
|
|
|
|
|
|
class ContactInfo:
|
|
def __init__(self, _id: Optional[int],
|
|
email: str,
|
|
phone_numbers: List[PhoneNumber],
|
|
head: List['Head'],
|
|
locations: List['Location']
|
|
):
|
|
self.id = _id
|
|
self.phone_numbers = phone_numbers
|
|
self.head = head
|
|
self.email = email
|
|
self.locations = locations
|
|
|
|
|
|
@dataclass
|
|
class Activity:
|
|
id: Optional[int]
|
|
name: str
|
|
|
|
|
|
@dataclass
|
|
class Division:
|
|
id: Optional[int]
|
|
contact_info: ContactInfo
|
|
activities: List[Activity]
|
|
|
|
|
|
@dataclass
|
|
class Head:
|
|
id: Optional[int]
|
|
date_of_start: date
|
|
date_of_end: Optional[date]
|
|
|
|
|
|
@dataclass
|
|
class Location:
|
|
id: Optional[int]
|
|
country: str
|
|
city: str
|
|
street: str
|
|
house: str
|
|
room: str
|
|
date_of_start: date
|
|
date_of_end: Optional[date]
|