{
    "openapi": "3.0.0",
    "info": {
        "title": "API BACKEND MAPS",
        "version": "1.0.0"
    },
    "paths": {
        "/api/upload/img": {
            "post": {
                "tags": [
                    "Image"
                ],
                "summary": "Store an uploaded image",
                "operationId": "448ae4b4a26aa7f291bb96a14565697d",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "properties": {
                                    "image": {
                                        "description": "Image file to upload",
                                        "type": "string",
                                        "format": "binary"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Image uploaded successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string",
                                            "example": "Image uploaded successfully"
                                        },
                                        "image": {
                                            "properties": {
                                                "id": {
                                                    "type": "integer",
                                                    "example": 1
                                                },
                                                "user_name": {
                                                    "type": "string",
                                                    "example": "nameuser"
                                                },
                                                "path": {
                                                    "type": "string",
                                                    "example": "public/images/your_image.jpg"
                                                },
                                                "created_at": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "example": "2024-01-01T00:00:00.000000Z"
                                                },
                                                "updated_at": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "example": "2024-01-01T00:00:00.000000Z"
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Validation error",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "properties": {
                                                "image": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "string",
                                                        "example": "The image field is required."
                                                    }
                                                }
                                            },
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Image upload failed",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "error": {
                                            "type": "string",
                                            "example": "Image upload failed"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/wordpress/post": {
            "post": {
                "summary": "Create a post with featured media",
                "operationId": "4175f97cd4f805d20a54b4c148472645",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "title": {
                                        "description": "Title of the post",
                                        "type": "string"
                                    },
                                    "content": {
                                        "description": "Content of the post",
                                        "type": "string"
                                    },
                                    "status": {
                                        "description": "Status of the post",
                                        "type": "string"
                                    },
                                    "media_id": {
                                        "description": "ID of the featured media",
                                        "type": "integer"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Post created successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "status": {
                                            "type": "integer"
                                        },
                                        "body": {
                                            "type": "object"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/upload-media": {
            "post": {
                "summary": "Upload media",
                "operationId": "724e5f22e1b895ed624f6b13fb78991a",
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "properties": {
                                    "file": {
                                        "description": "The file to upload",
                                        "type": "file"
                                    }
                                },
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "File uploaded successfully",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "properties": {
                                        "message": {
                                            "type": "string"
                                        },
                                        "media_id": {
                                            "type": "integer"
                                        }
                                    },
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/create-map": {
            "post": {
                "tags": ["Map"],
                "summary": "Create a new map",
                "operationId": "createMap",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "properties": {
                                    "user": {
                                        "type": "object",
                                        "properties": {
                                            "ID": {
                                                "type": "string",
                                                "description": "User ID"
                                            },
                                            "userLogin": {
                                                "type": "string",
                                                "description": "User login"
                                            },
                                            "userEmail": {
                                                "type": "string",
                                                "description": "User email"
                                            },
                                            "displayName": {
                                                "type": "string",
                                                "description": "User display name"
                                            }
                                        }
                                    },
                                    "boundaries": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string",
                                                    "description": "Boundary ID"
                                                },
                                                "distance": {
                                                    "type": "number",
                                                    "description": "Distance value"
                                                },
                                                "units": {
                                                    "type": "string",
                                                    "description": "Units of measurement"
                                                }
                                            }
                                        }
                                    },
                                    "polygons": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "id": {
                                                    "type": "string",
                                                    "description": "Polygon ID"
                                                },
                                                "isFreehand": {
                                                    "type": "boolean",
                                                    "description": "Is polygon freehand drawn?"
                                                },
                                                "totalArea": {
                                                    "type": "number",
                                                    "description": "Total area of the polygon"
                                                },
                                                "units": {
                                                    "type": "string",
                                                    "description": "Unit of area measurement"
                                                },
                                                "coordinates": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "lat": {
                                                                "type": "number"
                                                            },
                                                            "lng": {
                                                                "type": "number"
                                                            }
                                                        }
                                                    }
                                                },
                                                "triangles": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "object",
                                                        "properties": {
                                                            "id": {
                                                                "type": "string",
                                                                "description": "Triangle ID"
                                                            },
                                                            "coordinates": {
                                                                "type": "array",
                                                                "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                        "lat": {
                                                                            "type": "number"
                                                                        },
                                                                        "lng": {
                                                                            "type": "number"
                                                                        }
                                                                    }
                                                                }
                                                            },
                                                            "area": {
                                                                "type": "number",
                                                                "description": "Area of the triangle"
                                                            },
                                                            "color": {
                                                                "type": "string",
                                                                "description": "Color representation"
                                                            },
                                                            "layerId": {
                                                                "type": "integer",
                                                                "description": "Layer ID"
                                                            },
                                                            "parentId": {
                                                                "type": "string",
                                                                "description": "Parent polygon ID"
                                                            }
                                                        }
                                                    }
                                                },
                                                "color": {
                                                    "type": "string",
                                                    "description": "Color of the polygon"
                                                },
                                                "layerId": {
                                                    "type": "integer",
                                                    "description": "Layer ID"
                                                },
                                                "radius": {
                                                    "type": "number",
                                                    "description": "Radius if the shape is circular"
                                                }
                                            }
                                        }
                                    }
                                },
                                "type": "object"
                            }
                        }
                    },
                    "responses": {
                        "201": {
                            "description": "Map created successfully",
                            "content": {
                                "application/json": {
                                    "schema": {
                                        "properties": {
                                            "message": {
                                                "type": "string",
                                                "example": "Map created successfully"
                                            },
                                            "map_id": {
                                                "type": "integer",
                                                "example": 1
                                            }
                                        },
                                        "type": "object"
                                    }
                                }
                            }
                        },
                        "400": {
                            "description": "Validation error",
                            "content": {
                                "application/json": {
                                    "schema": {
                                        "properties": {
                                            "error": {
                                                "type": "string",
                                                "example": "Invalid input data"
                                            }
                                        },
                                        "type": "object"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }    
    }
}