{
    "openapi": "3.1.0",
    "info": {
        "title": "Wakafrica API",
        "version": "1.0.0",
        "summary": "API publique de la plateforme Wakafrica.",
        "description": "API publique de Wakafrica : catalogue des programmes immobiliers UrbAfrica et authentification des applications Wakafrica. Documentation : https://wakafrica.com/developpeurs",
        "contact": {
            "name": "Wakafrica",
            "url": "https://wakafrica.com/contact"
        }
    },
    "servers": [
        {
            "url": "https://wakafrica.com/api",
            "description": "Production"
        }
    ],
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "Jeton personnel Laravel Sanctum obtenu via /auth/login."
            }
        },
        "schemas": {
            "Program": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "title": {
                        "type": "string"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "short_description": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "program_type": {
                        "type": "string"
                    },
                    "funding_goal": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "funds_raised": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "total_units": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "available_units": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "is_featured": {
                        "type": "boolean"
                    },
                    "is_verified": {
                        "type": "boolean"
                    },
                    "cover_image_url": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            },
            "Property": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "title": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string"
                    },
                    "surface_area": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "bedrooms": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "bathrooms": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "price": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "description": "Renvoyé uniquement aux appelants authentifiés."
                    },
                    "status": {
                        "type": "string"
                    }
                }
            }
        }
    },
    "paths": {
        "/v1/urbafrica/programs": {
            "get": {
                "operationId": "listPrograms",
                "summary": "Liste les programmes immobiliers publiés",
                "tags": [
                    "Programmes"
                ],
                "security": [],
                "responses": {
                    "200": {
                        "description": "Catalogue des programmes publics",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "programs": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Program"
                                            }
                                        },
                                        "featured": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Program"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/v1/urbafrica/programs/{id}": {
            "get": {
                "operationId": "showProgram",
                "summary": "Détail d'un programme immobilier publié",
                "tags": [
                    "Programmes"
                ],
                "security": [],
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Programme, lots disponibles et projets de financement associés",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "program": {
                                            "$ref": "#/components/schemas/Program"
                                        },
                                        "properties": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Property"
                                            }
                                        },
                                        "projects": {
                                            "type": "array",
                                            "items": {
                                                "type": "object"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Programme inconnu ou non publié"
                    }
                }
            }
        },
        "/auth/login": {
            "post": {
                "operationId": "login",
                "summary": "Authentifie un utilisateur et renvoie un jeton Sanctum",
                "tags": [
                    "Authentification"
                ],
                "security": [],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "email",
                                    "password"
                                ],
                                "properties": {
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "password": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Utilisateur et jeton porteur"
                    },
                    "422": {
                        "description": "Identifiants incorrects ou champs invalides"
                    }
                }
            }
        },
        "/auth/register": {
            "post": {
                "operationId": "register",
                "summary": "Crée un compte et renvoie un jeton Sanctum",
                "tags": [
                    "Authentification"
                ],
                "security": [],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "name",
                                    "email",
                                    "password",
                                    "password_confirmation"
                                ],
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "maxLength": 255
                                    },
                                    "email": {
                                        "type": "string",
                                        "format": "email"
                                    },
                                    "password": {
                                        "type": "string",
                                        "minLength": 8
                                    },
                                    "password_confirmation": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Compte créé"
                    },
                    "422": {
                        "description": "Champs invalides"
                    }
                }
            }
        },
        "/auth/me": {
            "get": {
                "operationId": "me",
                "summary": "Profil de l'utilisateur authentifié",
                "tags": [
                    "Authentification"
                ],
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Profil utilisateur"
                    },
                    "401": {
                        "description": "Jeton absent ou invalide"
                    }
                }
            }
        },
        "/auth/logout": {
            "post": {
                "operationId": "logout",
                "summary": "Révoque le jeton courant",
                "tags": [
                    "Authentification"
                ],
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Jeton révoqué"
                    },
                    "401": {
                        "description": "Jeton absent ou invalide"
                    }
                }
            }
        }
    }
}