{
    "openapi": "3.1.0",
    "info": {
        "title": "JOFC Corato — Agent Data Layer",
        "version": "1.0.0",
        "description": "Endpoint JSON pubblici, in sola lettura e senza autenticazione, del Juventus Official Fan Club Corato: dati del club, calendario partite Juventus, trasferte organizzate, comunicazioni e indice delle pagine del sito. Cache consigliata: 1 ora.",
        "contact": {
            "name": "JOFC Corato",
            "url": "https://jofccorato.it/contatti/"
        }
    },
    "servers": [
        {
            "url": "https://jofccorato.it"
        }
    ],
    "paths": {
        "/agent/index.json": {
            "get": {
                "operationId": "getIndex",
                "summary": "Indice degli endpoint disponibili",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Index"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/agent/club.json": {
            "get": {
                "operationId": "getClub",
                "summary": "Dati istituzionali del club (sede, contatti, social)",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Club"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/agent/matches.json": {
            "get": {
                "operationId": "getMatches",
                "summary": "Calendario completo delle partite della Juventus",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Matches"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/agent/trips.json": {
            "get": {
                "operationId": "getTrips",
                "summary": "Trasferte organizzate dal club",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Trips"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/agent/announcements.json": {
            "get": {
                "operationId": "getAnnouncements",
                "summary": "Ultime comunicazioni e articoli",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Announcements"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/agent/pages.json": {
            "get": {
                "operationId": "getPages",
                "summary": "Pagine pubbliche con URL HTML e Markdown",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Pages"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "Index": {
                "type": "object",
                "additionalProperties": true
            },
            "Club": {
                "type": "object",
                "properties": {
                    "endpoint": {
                        "type": "string"
                    },
                    "data": {
                        "type": "object",
                        "additionalProperties": true
                    }
                }
            },
            "Matches": {
                "type": "object",
                "properties": {
                    "endpoint": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "generatedAt": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "count": {
                        "type": "integer"
                    },
                    "items": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Match"
                        }
                    }
                }
            },
            "Match": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "homeTeam": {
                        "type": "string"
                    },
                    "awayTeam": {
                        "type": "string"
                    },
                    "isHome": {
                        "type": "boolean"
                    },
                    "startDate": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "endDate": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "league": {
                        "type": "string"
                    },
                    "round": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "description": "NS non iniziata, FT finita, 1H/HT/2H in corso"
                    },
                    "score": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "audience": {
                        "type": "string"
                    },
                    "action": {
                        "type": "string"
                    },
                    "actionUrl": {
                        "type": "string",
                        "format": "uri"
                    }
                }
            },
            "Trips": {
                "type": "object",
                "properties": {
                    "endpoint": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "generatedAt": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "count": {
                        "type": "integer"
                    },
                    "items": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Trip"
                        }
                    }
                }
            },
            "Trip": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "title": {
                        "type": "string"
                    },
                    "opponent": {
                        "type": "string"
                    },
                    "startDate": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "venue": {
                        "type": "string"
                    },
                    "meetingPoint": {
                        "type": "string"
                    },
                    "departureTime": {
                        "type": "string"
                    },
                    "priceEur": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string",
                        "description": "open, closed, cancelled, sold_out"
                    },
                    "bookingUrl": {
                        "type": "string",
                        "format": "uri"
                    }
                }
            },
            "Announcements": {
                "type": "object",
                "properties": {
                    "endpoint": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "generatedAt": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "count": {
                        "type": "integer"
                    },
                    "items": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Announcement"
                        }
                    }
                }
            },
            "Announcement": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "title": {
                        "type": "string"
                    },
                    "excerpt": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "status": {
                        "type": "string"
                    }
                }
            },
            "Pages": {
                "type": "object",
                "properties": {
                    "endpoint": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "generatedAt": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "count": {
                        "type": "integer"
                    },
                    "items": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Page"
                        }
                    }
                }
            },
            "Page": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "home",
                            "page",
                            "post"
                        ]
                    },
                    "title": {
                        "type": "string"
                    },
                    "description": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "markdownUrl": {
                        "type": "string",
                        "format": "uri"
                    },
                    "publishedAt": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updatedAt": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "categories": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            }
        }
    }
}