# Path: dhis2_core/src/dhis2/e2b/models/e2b.py
# class AttributeValue(BaseModel):
#     created: datetime
#     lastUpdated: datetime
#     attribute: str
#     value: str
#     storedBy: Optional[str]
# 
# class EventDataValue(BaseModel):
#     created: datetime
#     lastUpdated: datetime
#     dataElement: str
#     value: str
#     providedElsewhere: bool
#     storedBy: Optional[str]
# 
# class TrackedEntity(BaseModel):
#     created: datetime
#     lastUpdated: datetime
#     trackedEntityInstance: str
#     trackedEntityType: str
#     orgUnit: str
#     storedBy: Optional[str]
#     enrollments: List[Enrollment] = []
#     attributes: Union[Dict[str, AttributeValue], List[AttributeValue]] = []


from typing import Dict
from dhis2.core.http import BaseHttpRequest
from dhis2.core.inventory import HostResolved, resolve_one
from .models.e2b import AttributeValue, EventDataValue, TrackedEntity
import click
import dhis2.e2b.r2 as r2

        del en.attributes

        events = {}

        for ev in en.events:
            dataValues: Dict[str, EventDataValue] = {}

            for dv in ev.dataValues:
                dataValues[dv.dataElement] = dv

            events[ev.programStage] = ev
            ev.dataValues = dataValues

        en.events = events

    te.attributes = attributes

    return te


@click.command("e2b")
@click.argument("host-id")
@click.option("--country", default="unknown")
@click.option("--sender-id", default="unknown")
@click.option("--receiver-id", default="unknown")
@click.option("--receiver-organization", default="WHO-UMC")
@click.option("--receiver-code", default="SE")
@click.option("--tracked-entity", default="zAt1I8i6c83")
@click.pass_obj

# Path: dhis2_core/src/dhis2/e2b/models/e2b.py
# class AttributeValue(BaseModel):
#     created: datetime
#     lastUpdated: datetime
#     attribute: str
#     value: str
#     storedBy: Optional[str]
# 
# class EventDataValue(BaseModel):
#     created: datetime
#     lastUpdated: datetime
#     dataElement: str
#     value: str
#     providedElsewhere: bool
#     storedBy: Optional[str]
# 
# class TrackedEntity(BaseModel):
#     created: datetime
#     lastUpdated: datetime
#     trackedEntityInstance: str
#     trackedEntityType: str
#     orgUnit: str
#     storedBy: Optional[str]
#     enrollments: List[Enrollment] = []
#     attributes: Union[Dict[str, AttributeValue], List[AttributeValue]] = []


# Path: dhis2_core/src/dhis2/e2b/cli.py
from typing import Dict
from dhis2.core.http import BaseHttpRequest
from dhis2.core.inventory import HostResolved, resolve_one
from .models.e2b import AttributeValue, EventDataValue, TrackedEntity
import click
import dhis2.e2b.r2 as r2


        del en.attributes

        events = {}

        for ev in en.events:
            dataValues: Dict[str, EventDataValue] = {}

            for dv in ev.dataValues:
                dataValues[dv.dataElement] = dv

            events[ev.programStage] = ev
            ev.dataValues = dataValues

        en.events = events

    te.attributes = attributes

    return te


@click.command("e2b")
@click.argument("host-id")
@click.option("--country", default="unknown")
@click.option("--sender-id", default="unknown")
@click.option("--receiver-id", default="unknown")
@click.option("--receiver-organization", default="WHO-UMC")
@click.option("--receiver-code", default="SE")
@click.option("--tracked-entity", default="zAt1I8i6c83")
@click.pass_obj

def cmd_e2b(