{
  "openapi": "3.0.3",
  "info": {
    "title": "OpenAPI per Registrar CMS",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.pubtest.nic.it"
    }
  ],
  "tags": [
    {
      "name": "CMS API",
      "description": "API CMS reserved to Registrar"
    }
  ],
  "paths": {
    "/v1/cms/folders": {
      "get": {
        "tags": [
          "CMS API"
        ],
        "summary": "Get CMS folders list",
        "operationId": "getCMSFolders",
        "parameters": [
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/CMSLanguage"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CMSFolderList"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "registrar_authentication": []
          }
        ]
      }
    },
    "/v1/cms/folders/{folderId}": {
      "get": {
        "tags": [
          "CMS API"
        ],
        "summary": "Get CMS folder content by id",
        "operationId": "getCMSFolderById",
        "parameters": [
          {
            "name": "folderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "lang",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/CMSLanguage"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CMSFolder"
                }
              }
            }
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "registrar_authentication": []
          }
        ]
      }
    },
    "/v1/cms/files/{fileId}": {
      "get": {
        "tags": [
          "CMS API"
        ],
        "summary": "Get CMS file content by id",
        "operationId": "getCMSFileById",
        "parameters": [
          {
            "name": "fileId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "registrar_authentication": []
          }
        ]
      }
    },
    "/v1/cms/news": {
      "get": {
        "tags": [
          "CMS API"
        ],
        "summary": "Get CMS news",
        "operationId": "getCMSNews",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CMSNewsList"
                }
              }
            }
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "registrar_authentication": []
          }
        ]
      }
    },
    "/v1/cms/meetings": {
      "get": {
        "tags": [
          "CMS API"
        ],
        "summary": "Get CMS meetings list",
        "operationId": "getCMSMeetings",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CMSMeeting"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "registrar_authentication": []
          }
        ]
      }
    },
    "/v1/cms/meetings/{meetingId}": {
      "get": {
        "tags": [
          "CMS API"
        ],
        "summary": "Get CMS meeting by id",
        "operationId": "getCMSMeetingById",
        "parameters": [
          {
            "name": "meetingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CMSMeeting"
                }
              }
            }
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "registrar_authentication": []
          }
        ]
      }
    },
    "/v1/cms/meetings/{meetingId}/signup": {
      "post": {
        "tags": [
          "CMS API"
        ],
        "summary": "Sign up to a meeting",
        "operationId": "cmsMeetingSignup",
        "parameters": [
          {
            "name": "meetingId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CMSMeetingSignup"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful sign up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CMSSignupResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, meeting closed or not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CMSSignupResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "409": {
            "description": "User already sign up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CMSSignupResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "registrar_authentication": []
          }
        ]
      }
    },
    "/v1/cms/courses": {
      "get": {
        "tags": [
          "CMS API"
        ],
        "summary": "Get CMS courses list",
        "operationId": "getCMSCourses",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CMSCourse"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "registrar_authentication": []
          }
        ]
      }
    },
    "/v1/cms/courses/criteria": {
      "get": {
        "tags": [
          "CMS API"
        ],
        "summary": "Get CMS criteria for course participation",
        "operationId": "getCMSCourseCriteria",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CMSCourseCriteriaLang"
                }
              }
            }
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "registrar_authentication": []
          }
        ]
      }
    },
    "/v1/cms/courses/{courseId}": {
      "get": {
        "tags": [
          "CMS API"
        ],
        "summary": "Get CMS course by id",
        "operationId": "getCMSCourseById",
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CMSCourse"
                }
              }
            }
          },
          "401": {
            "description": "Not Authorized"
          },
          "403": {
            "description": "Not Allowed"
          }
        },
        "security": [
          {
            "registrar_authentication": []
          }
        ]
      }
    },
    "/v1/cms/courses/{courseId}/signup": {
      "post": {
        "tags": [
          "CMS API"
        ],
        "summary": "Sign up to a course",
        "operationId": "cmsCourseSignup",
        "parameters": [
          {
            "name": "courseId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CMSCourseSignup"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful sign up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CMSSignupResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, meeting closed or not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CMSSignupResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "409": {
            "description": "User already sign up",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CMSSignupResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "registrar_authentication": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "CMSFolderList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        }
      },
      "CMSFolder": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string",
            "description": "text or html description of folder"
          },
          "lang": {
            "$ref": "#/components/schemas/CMSLanguage"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CMSFile"
            }
          }
        }
      },
      "CMSFile": {
        "type": "object",
        "properties": {
          "fid": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "filemime": {
            "type": "string"
          },
          "filesize": {
            "type": "string"
          },
          "timestamp": {
            "type": "string"
          }
        }
      },
      "CMSLanguage": {
        "type": "string",
        "enum": [
          "it",
          "en"
        ]
      },
      "CMSNewsList": {
        "type": "object",
        "properties": {
          "News": {
            "$ref": "#/components/schemas/CMSNewsLang"
          }
        }
      },
      "CMSNewsLang": {
        "type": "object",
        "properties": {
          "en": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CMSNews"
            }
          },
          "it": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CMSNews"
            }
          }
        }
      },
      "CMSNews": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "created": {
            "type": "string"
          }
        }
      },
      "CMSLocation": {
        "type": "object",
        "properties": {
          "city": {
            "type": "string"
          },
          "latitude": {
            "type": "string"
          },
          "longitude": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "postal_code": {
            "type": "string"
          },
          "province": {
            "type": "string"
          },
          "provisional": {
            "type": "boolean"
          },
          "online": {
            "type": "boolean"
          },
          "street": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        }
      },
      "CMSDate": {
        "type": "object",
        "properties": {
          "from": {
            "type": "integer",
            "format": "int64"
          },
          "provisional": {
            "type": "boolean"
          },
          "to": {
            "type": "integer",
            "format": "int64"
          },
          "type": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "CMSAgenda": {
        "type": "object",
        "properties": {
          "it": {
            "type": "object",
            "description": "Agenda giorno per giorno",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/CMSAgendaItem"
              }
            }
          },
          "en": {
            "type": "object",
            "description": "Day by day agenda",
            "additionalProperties": {
              "$ref": "#/components/schemas/CMSAgendaItem"
            }
          }
        }
      },
      "CMSAgendaItem": {
        "type": "object",
        "properties": {
          "type": {
            "enum": [
              "Talks",
              "Break",
              "Lunch"
            ]
          },
          "start": {
            "type": "string"
          },
          "end": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CMSFile"
            }
          }
        }
      },
      "CMSMeeting": {
        "type": "object",
        "properties": {
          "date": {
            "$ref": "#/components/schemas/CMSDate"
          },
          "enrollment": {
            "type": "integer",
            "format": "int64"
          },
          "enrollment_deadline": {
            "type": "integer",
            "format": "int64"
          },
          "id": {
            "type": "string"
          },
          "intro": {
            "type": "object",
            "properties": {
              "en": {
                "type": "string"
              },
              "it": {
                "type": "string"
              }
            }
          },
          "location": {
            "$ref": "#/components/schemas/CMSLocation"
          },
          "title": {
            "type": "object",
            "properties": {
              "en": {
                "type": "string"
              },
              "it": {
                "type": "string"
              }
            }
          },
          "agenda": {
            "$ref": "#/components/schemas/CMSAgenda"
          },
          "social_dinner": {
            "type": "boolean"
          },
          "url_streaming": {
            "properties": {
              "it": {
                "type": "string"
              },
              "en": {
                "type": "string"
              }
            }
          },
          "accomodations": {
            "properties": {
              "it": {
                "type": "string"
              },
              "en": {
                "type": "string"
              }
            }
          },
          "general_info": {
            "properties": {
              "it": {
                "type": "string"
              },
              "en": {
                "type": "string"
              }
            }
          },
          "attendees": {
            "type": "string"
          },
          "confirmed_attendees": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CMSFile"
            }
          }
        }
      },
      "CMSCourse": {
        "type": "object",
        "properties": {
          "date": {
            "$ref": "#/components/schemas/CMSDate"
          },
          "enrollment": {
            "type": "integer",
            "format": "int64"
          },
          "enrollment_deadline": {
            "type": "integer",
            "format": "int64"
          },
          "id": {
            "type": "string"
          },
          "intro": {
            "type": "object",
            "properties": {
              "en": {
                "type": "string"
              },
              "it": {
                "type": "string"
              }
            }
          },
          "location": {
            "$ref": "#/components/schemas/CMSLocation"
          },
          "title_en": {
            "type": "string"
          },
          "title_it": {
            "type": "string"
          },
          "abstract_en": {
            "type": "string"
          },
          "abstract_it": {
            "type": "string"
          },
          "programma_en": {
            "type": "string"
          },
          "programma_it": {
            "type": "string"
          },
          "attendees": {
            "type": "string"
          },
          "max_attendee": {
            "type": "string"
          },
          "confirmed_attendees": {
            "type": "string"
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CMSFile"
            }
          }
        }
      },
      "CMSCourseCriteriaLang": {
        "type": "object",
        "properties": {
          "en": {
            "$ref": "#/components/schemas/CMSCourseCriteria"
          },
          "it": {
            "$ref": "#/components/schemas/CMSCourseCriteria"
          }
        }
      },
      "CMSCourseCriteria": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "body": {
            "type": "string"
          }
        }
      },
      "CMSSignupResponse": {
        "type": "object",
        "properties": {
          "response": {
            "description": "True if signup was successful",
            "type": "boolean"
          },
          "description": {
            "type": "string",
            "description": "text or html description of folder"
          }
        }
      },
      "CMSCourseSignup": {
        "type": "object",
        "required": [
          "name",
          "surname",
          "email",
          "phone"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "surname": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone": {
            "type": "string"
          }
        }
      },
      "CMSMeetingSignup": {
        "type": "object",
        "required": [
          "name",
          "surname",
          "email",
          "phone"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "surname": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phone": {
            "type": "string"
          },
          "dinner": {
            "type": "boolean"
          },
          "shuttle": {
            "type": "boolean"
          }
        }
      }
    },
    "securitySchemes": {
      "registrar_authentication": {
        "type": "oauth2",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://auth.pubtest.nic.it/auth/realms/registrar/protocol/openid-connect/auth",
            "tokenUrl": "https://auth.pubtest.nic.it/auth/realms/registrar/protocol/openid-connect/token",
            "scopes": {
              "security": "security scope",
              "domain": "domain scope",
              "darwin": "darwin scope",
              "billing": "billing scope"
            }
          }
        }
      }
    }
  }
}