"""
Temporary message definition to handle the MAS-DT dry-run mode 

In dry-run the SFMC adapter will receive misson_plan messages from ORI
These messages will be parsed and compiled into a goto file which will
not be sent on to the glider 

To confirm the message flow is working the SFMC will instead publish 
a waypoints message back to the backbone which C2 can receive and 
process - adding simulated waypoints to C2 positions 
"""

waypoint_schema = {
    "type": "object",
    "oneOf": [
        {
            "$ref": "https://geojson.org/schema/Point.json",
        },
        {
            "type": "object",
            "properties": {
                "latitude": {
                    "type": "number",
                    "format": "float",
                    "description": "Latitude (Y-coordinate) in decimal degrees.",
                    "example": 178.2,
                },
                "longitude": {
                    "type": "number",
                    "format": "float",
                    "description": "Longitude (X-coordinate) in decimal degrees.",
                    "example": -10.122,
                },
                "depth": {
                    "type": "number",
                    "format": "float",
                    "description": "Target depth in metres",
                    "example": 50.0,
                    "default": 0.0,
                },
                "altitude": {
                    "type": "number",
                    "format": "float",
                    "description": "Target altitude in metres",
                    "example": 20.0,
                },
            },
            "required": [
                "latitude",
                "longitude",
            ],
        },
    ],
}

waypoints_schema = {
    "type": "object",
    "properties": {
        "message_type": {
            "type": "string",
            "description": "Type of message",
            "example": "waypoints",
            "enum": ["waypoints"],
        },
        "platform_ID": {
            "type": "string",
            "description": "Unique identifier for this platform",
            "example": "reav-x-1",
        },
        "status_source": {
            "type": "string",
            "enum": ["onboard_platform", "simulated", "autonomy"],
            "description": "Indicate if this status message is from the"
            + " platform or USBL",
            "example": "usbl",
        },
        "platform_timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp for onboard platform status message",
            "example": "2022-12-21T00:00:00Z",
        },
        "waypoints": {
            "type": "array",
            "items": waypoint_schema,
        },
    },
    "required": [
        "message_type",
        "platform_ID",
        "status_source",
        "platform_timestamp",
        "waypoints",
    ],
}