import uuid from typing import List, Set from sqlalchemy import Column from sqlalchemy.orm import relationship from sqlalchemy_utils import PhoneNumber from ereuse_devicehub.resources.event.models import Event, Trade from ereuse_devicehub.resources.models import Thing from ereuse_devicehub.resources.user import User from teal import enums class Agent(Thing): id = ... # type: Column name = ... # type: Column tax_id = ... # type: Column country = ... # type: Column telephone = ... # type: Column email = ... # type: Column def __init__(self, **kwargs) -> None: super().__init__(**kwargs) self.id = ... # type: uuid.UUID self.name = ... # type: str self.tax_id = ... # type: str self.country = ... # type: enums.Country self.telephone = ... # type: PhoneNumber self.email = ... # type: str self.events_agent = ... # type: Set[Event] # Ordered self.events_to = ... # type: Set[Trade] # Ordered @property def events(self) -> List[Event]: pass class Organization(Agent): def __init__(self, name: str, **kwargs): super().__init__(**kwargs) self.members = ... # type: Set[Membership] @classmethod def get_default_org_id(cls) -> uuid.UUID: pass class Individual(Agent): member_of = ... # type:relationship active_org_id = ... # type:Column active_org = ... # type:relationship user_id = ... # type:Column user = ... # type:relationship def __init__(self, **kwargs) -> None: super().__init__(**kwargs) self.member_of = ... # type: Set[Membership] self.active_org = ... # type: Organization self.user = ... # type: User class Membership(Thing): organization = ... # type: Column individual = ... # type: Column id = ... # type: Column def __init__(self, organization: Organization, individual: Individual, id: str = None) -> None: super().__init__() self.organization = ... # type: Organization self.individual = ... # type: Individual self.id = ... # type: str class Person(Individual): pass class System(Individual): pass