{
  "openapi": "3.1.0",
  "info": {
    "title": "biletebus.ro — API de vânzare (parteneri)",
    "version": "1.0.0",
    "description": "Documentație: https://biletebus.ro/dezvoltatori/. Răspunsurile au mereu \"ok\"; la eroare \"ok\": false și \"mesaj\"."
  },
  "servers": [
    {
      "url": "https://biletebus.ro/api/partner/v1"
    }
  ],
  "security": [
    {
      "requestor": [],
      "cheie": []
    }
  ],
  "components": {
    "securitySchemes": {
      "requestor": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Requestor-Id"
      },
      "cheie": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Api-Key"
      }
    },
    "schemas": {
      "Eroare": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": false
          },
          "mesaj": {
            "type": "string"
          }
        },
        "required": [
          "ok",
          "mesaj"
        ]
      }
    }
  },
  "paths": {
    "/": {
      "get": {
        "summary": "Canalul tău",
        "operationId": "eu",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "canal": {
                    "nume": "Agenția Test",
                    "fel": "agentie",
                    "requestor_id": "BBS7RB78S2",
                    "comision_procent": 5,
                    "operator": {
                      "slug": "carpatica",
                      "nume": "Carpatica Trans"
                    },
                    "trasee_permise": null
                  }
                }
              }
            }
          },
          "400": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "401": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "404": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "409": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "429": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          }
        }
      }
    },
    "/localitati": {
      "get": {
        "summary": "Caută localități",
        "operationId": "localitati",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": ""
          },
          {
            "name": "cu_curse",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "1 = doar unde ai curse"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "localitati": [
                    {
                      "id": 4,
                      "nume": "Constanța",
                      "slug": "constanta",
                      "judet": "CT",
                      "tara": "RO",
                      "tip": "municipiu",
                      "comuna": "municipiul Constanța"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "401": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "404": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "409": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "429": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          }
        }
      }
    },
    "/cautare": {
      "get": {
        "summary": "Caută curse",
        "operationId": "cautare",
        "parameters": [
          {
            "name": "de",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "slug sau id"
          },
          {
            "name": "pana",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "slug sau id"
          },
          {
            "name": "data",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "AAAA-LL-ZZ"
          },
          {
            "name": "adult",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9
            }
          },
          {
            "name": "copil",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9
            }
          },
          {
            "name": "elev",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9
            }
          },
          {
            "name": "student",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9
            }
          },
          {
            "name": "pensionar",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "comision_procent": 5,
                  "curse": [
                    {
                      "cursa_id": 57,
                      "data": "2026-10-24",
                      "pleaca": "2026-10-24 04:00",
                      "ajunge": "2026-10-24 08:35",
                      "durata_min": 275,
                      "operator": {
                        "id": 1,
                        "slug": "carpatica",
                        "nume": "Carpatica Trans",
                        "scurt": "CT",
                        "culoare": "#1b46ee",
                        "telefon": "0700 000 101",
                        "rating": 4.7
                      },
                      "traseu": {
                        "id": 1,
                        "cod": "K1",
                        "nume": "Constanța – Otopeni",
                        "tip": "regulat",
                        "international": false
                      },
                      "confirmata": true,
                      "minim_pasageri": null,
                      "nota": null,
                      "de": {
                        "ordine": 0,
                        "statie_id": 6,
                        "statie": "Autogara Sud",
                        "statie_slug": "autogara-sud",
                        "tip": "autogara",
                        "localitate": "Constanța",
                        "localitate_slug": "constanta"
                      },
                      "pana": {
                        "ordine": 3,
                        "statie_id": 4,
                        "statie": "Aeroport Henri Coandă — Sosiri",
                        "statie_slug": "aeroport-henri-coanda-sosiri",
                        "tip": "aeroport",
                        "localitate": "Otopeni",
                        "localitate_slug": "otopeni"
                      },
                      "opriri": [
                        {
                          "ordine": 0,
                          "statie": "Autogara Sud",
                          "localitate": "Constanța",
                          "km": 0,
                          "ora": "04:00"
                        }
                      ],
                      "directa": true,
                      "dotari": [
                        "wifi"
                      ],
                      "bagaj": "1 bagaj de cală + 1 de mână",
                      "locuri_libere": 49,
                      "locuri_total": 49,
                      "pret_adult": 75,
                      "pret_adult_lista": 75,
                      "oferta": null,
                      "preturi": {
                        "adult": {
                          "pret": 75,
                          "pret_lista": 75,
                          "fel": "dus",
                          "oferta": null,
                          "flex": []
                        }
                      },
                      "total": 150,
                      "moneda": "RON",
                      "vanzare_online": true,
                      "plata_la_urcare": true,
                      "plata_card": true,
                      "stare": "programata",
                      "mesaj": null
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "401": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "404": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "409": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "429": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          }
        }
      }
    },
    "/curse/{id}": {
      "get": {
        "summary": "Detaliile cursei și locurile",
        "operationId": "cursa",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "de_statie",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": ""
          },
          {
            "name": "pana_statie",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": ""
          },
          {
            "name": "adult",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9
            }
          },
          {
            "name": "copil",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9
            }
          },
          {
            "name": "elev",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9
            }
          },
          {
            "name": "student",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9
            }
          },
          {
            "name": "pensionar",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "cursa": {
                    "cursa_id": 57,
                    "data": "2026-10-24",
                    "pleaca": "2026-10-24 04:00",
                    "ajunge": "2026-10-24 08:35",
                    "durata_min": 275,
                    "operator": {
                      "id": 1,
                      "slug": "carpatica",
                      "nume": "Carpatica Trans",
                      "scurt": "CT",
                      "culoare": "#1b46ee",
                      "telefon": "0700 000 101",
                      "rating": 4.7
                    },
                    "traseu": {
                      "id": 1,
                      "cod": "K1",
                      "nume": "Constanța – Otopeni",
                      "tip": "regulat",
                      "international": false
                    },
                    "confirmata": true,
                    "minim_pasageri": null,
                    "nota": null,
                    "de": {
                      "ordine": 0,
                      "statie_id": 6,
                      "statie": "Autogara Sud",
                      "statie_slug": "autogara-sud",
                      "tip": "autogara",
                      "localitate": "Constanța",
                      "localitate_slug": "constanta"
                    },
                    "pana": {
                      "ordine": 3,
                      "statie_id": 4,
                      "statie": "Aeroport Henri Coandă — Sosiri",
                      "statie_slug": "aeroport-henri-coanda-sosiri",
                      "tip": "aeroport",
                      "localitate": "Otopeni",
                      "localitate_slug": "otopeni"
                    },
                    "opriri": [
                      {
                        "ordine": 0,
                        "statie": "Autogara Sud",
                        "localitate": "Constanța",
                        "km": 0,
                        "ora": "04:00"
                      },
                      {
                        "ordine": 1,
                        "statie": "Autogara Medgidia",
                        "localitate": "Medgidia",
                        "km": 36.3,
                        "ora": "04:45"
                      },
                      {
                        "ordine": 2,
                        "statie": "Autogara Slobozia",
                        "localitate": "Slobozia",
                        "km": 133.1,
                        "ora": "06:25"
                      }
                    ],
                    "directa": true,
                    "dotari": [
                      "wifi",
                      "prize",
                      "ac"
                    ],
                    "bagaj": "1 bagaj de cală + 1 de mână",
                    "locuri_libere": 49,
                    "locuri_total": 49,
                    "pret_adult": 75,
                    "pret_adult_lista": 75,
                    "oferta": null,
                    "preturi": {
                      "adult": {
                        "pret": 75,
                        "pret_lista": 75,
                        "fel": "dus",
                        "oferta": null,
                        "flex": []
                      }
                    },
                    "total": 150,
                    "moneda": "RON",
                    "vanzare_online": true,
                    "plata_la_urcare": true,
                    "plata_card": true,
                    "stare": "programata",
                    "mesaj": null
                  },
                  "circuit": [
                    {
                      "ordine": 0,
                      "statie_id": 6,
                      "statie": "Autogara Sud",
                      "localitate": "Constanța",
                      "km": 0,
                      "ora": "04:00",
                      "urcare": true,
                      "coborare": false
                    },
                    {
                      "ordine": 1,
                      "statie_id": 10,
                      "statie": "Autogara Medgidia",
                      "localitate": "Medgidia",
                      "km": 36.3,
                      "ora": "04:45",
                      "urcare": true,
                      "coborare": true
                    },
                    {
                      "ordine": 2,
                      "statie_id": 34,
                      "statie": "Autogara Slobozia",
                      "localitate": "Slobozia",
                      "km": 133.1,
                      "ora": "06:25",
                      "urcare": true,
                      "coborare": true
                    }
                  ],
                  "locuri": 49,
                  "schema": {
                    "randuri": [
                      [
                        1,
                        2,
                        null
                      ],
                      [
                        5,
                        6,
                        null
                      ],
                      [
                        9,
                        10,
                        null
                      ]
                    ],
                    "sofer": "stanga",
                    "usi": [
                      1,
                      6
                    ]
                  },
                  "ocupate": []
                }
              }
            }
          },
          "400": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "401": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "404": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "409": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "429": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          }
        }
      }
    },
    "/sesiuni": {
      "post": {
        "summary": "Blochează locuri 15 minute",
        "operationId": "sesiune",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "curse",
                  "pasageri"
                ],
                "properties": {
                  "curse": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 2,
                    "items": {
                      "type": "object",
                      "required": [
                        "cursa_id",
                        "de_statie_id",
                        "pana_statie_id"
                      ],
                      "properties": {
                        "cursa_id": {
                          "type": "integer"
                        },
                        "de_statie_id": {
                          "type": "integer"
                        },
                        "pana_statie_id": {
                          "type": "integer"
                        },
                        "locuri": {
                          "type": "array",
                          "items": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  },
                  "pasageri": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 9,
                    "items": {
                      "type": "object",
                      "properties": {
                        "categorie": {
                          "type": "string",
                          "enum": [
                            "adult",
                            "copil",
                            "elev",
                            "student",
                            "pensionar"
                          ]
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "curse": [
                  {
                    "cursa_id": 57,
                    "de_statie_id": 6,
                    "pana_statie_id": 4,
                    "locuri": [
                      1,
                      2
                    ]
                  }
                ],
                "pasageri": [
                  {
                    "categorie": "adult"
                  },
                  {
                    "categorie": "adult"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Locuri blocate",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "sesiune": "48a8a37ddfae1c2529a3c5e1",
                  "expira_la": "2026-10-23 02:29:26",
                  "total": 150,
                  "moneda": "RON",
                  "operator_id": 1,
                  "legs": [
                    {
                      "cursa_id": 57,
                      "traseu_id": 1,
                      "a": 0,
                      "b": 3,
                      "de_statie_id": 6,
                      "pana_statie_id": 4,
                      "pleaca": "2026-10-24 04:00:00",
                      "international": false,
                      "locuri": [
                        1,
                        2
                      ],
                      "linii": [
                        {
                          "categorie": "adult",
                          "pret": 75,
                          "pret_lista": 75,
                          "oferta_id": null,
                          "tva": 11,
                          "tarif_id": 5,
                          "fel": "dus"
                        },
                        {
                          "categorie": "adult",
                          "pret": 75,
                          "pret_lista": 75,
                          "oferta_id": null,
                          "tva": 11,
                          "tarif_id": 5,
                          "fel": "dus"
                        }
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "401": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "404": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "409": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "429": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          }
        }
      }
    },
    "/sesiuni/{id}": {
      "delete": {
        "summary": "Eliberează locurile",
        "operationId": "elibereaza",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "401": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "404": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "409": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "429": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          }
        }
      }
    },
    "/sesiuni/{id}/finalizare": {
      "post": {
        "summary": "Emite biletele",
        "operationId": "finalizare",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "pasageri",
                  "contact"
                ],
                "properties": {
                  "pasageri": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "required": [
                        "nume"
                      ],
                      "properties": {
                        "nume": {
                          "type": "string"
                        },
                        "act": {
                          "type": "string"
                        },
                        "nastere": {
                          "type": "string",
                          "format": "date"
                        }
                      }
                    }
                  },
                  "contact": {
                    "type": "object",
                    "required": [
                      "telefon"
                    ],
                    "properties": {
                      "telefon": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string"
                      }
                    }
                  },
                  "metoda_plata": {
                    "type": "string",
                    "enum": [
                      "card",
                      "la_urcare"
                    ]
                  },
                  "voucher": {
                    "type": "string"
                  },
                  "factura": {
                    "type": "object"
                  },
                  "observatii": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              },
              "example": {
                "pasageri": [
                  {
                    "nume": "Ion Popescu",
                    "act": "CT123456"
                  },
                  {
                    "nume": "Maria Popescu"
                  }
                ],
                "contact": {
                  "telefon": "0722111222",
                  "email": "client@example.ro"
                },
                "metoda_plata": "card"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Bilete emise",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "rezervare": {
                    "cod": "XFT2K5A4",
                    "operatie": "vanzare",
                    "stare": "activa",
                    "platita": true,
                    "metoda_plata": "card",
                    "asteapta_card": false,
                    "total": 150,
                    "reducere": 0,
                    "de_plata": 150,
                    "moneda": "RON",
                    "plata_pana": null,
                    "creat_la": "2026-10-23 02:14:26",
                    "operator": {
                      "nume": "Carpatica Trans",
                      "slug": "carpatica",
                      "telefon": "0700 000 101"
                    },
                    "canal": "agentie",
                    "contact": {
                      "telefon": "+40722111222",
                      "email": "client@example.ro"
                    },
                    "factura": null,
                    "bilete": [
                      {
                        "cod": "PJ6ZUBM2",
                        "qr": "BB1:PJ6ZUBM2:hyOZbeOG-x2b",
                        "stare": "vandut",
                        "categorie": "adult",
                        "fel": "dus",
                        "pret": 75,
                        "tva_procent": 11,
                        "pasager": "Ion Popescu",
                        "loc": 1,
                        "cursa_id": 57,
                        "traseu": "Constanța – Otopeni",
                        "traseu_cod": "K1",
                        "pleaca": "2026-10-24 04:00",
                        "ajunge": "2026-10-24 08:35",
                        "de": {
                          "statie": "Autogara Sud",
                          "localitate": "Constanța"
                        },
                        "pana": {
                          "statie": "Aeroport Henri Coandă — Sosiri",
                          "localitate": "Otopeni"
                        }
                      },
                      {
                        "cod": "KJM8SC3D",
                        "qr": "BB1:KJM8SC3D:euMZ9sF0WR4Z",
                        "stare": "vandut",
                        "categorie": "adult",
                        "fel": "dus",
                        "pret": 75,
                        "tva_procent": 11,
                        "pasager": "Maria Popescu",
                        "loc": 2,
                        "cursa_id": 57,
                        "traseu": "Constanța – Otopeni",
                        "traseu_cod": "K1",
                        "pleaca": "2026-10-24 04:00",
                        "ajunge": "2026-10-24 08:35",
                        "de": {
                          "statie": "Autogara Sud",
                          "localitate": "Constanța"
                        },
                        "pana": {
                          "statie": "Aeroport Henri Coandă — Sosiri",
                          "localitate": "Otopeni"
                        }
                      }
                    ],
                    "extra": [],
                    "rambursari": []
                  }
                }
              }
            }
          },
          "400": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "401": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "404": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "409": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "429": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          }
        }
      }
    },
    "/rezervari": {
      "get": {
        "summary": "Rezervările canalului",
        "operationId": "rezervari",
        "parameters": [
          {
            "name": "de",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "AAAA-LL-ZZ"
          },
          {
            "name": "pana",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "AAAA-LL-ZZ"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "de": "2026-09-23",
                  "pana": "2026-10-23",
                  "rezervari": [
                    {
                      "cod": "XFT2K5A4",
                      "operatie": "vanzare",
                      "stare": "activa",
                      "platita": true,
                      "total": 150,
                      "reducere": 0,
                      "de_plata": 150,
                      "comision": 7.5,
                      "moneda": "RON",
                      "creat_la": "2026-10-23 02:14:26"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "401": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "404": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "409": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "429": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          }
        }
      }
    },
    "/rezervari/{cod}": {
      "get": {
        "summary": "O rezervare",
        "operationId": "rezervare",
        "parameters": [
          {
            "name": "cod",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "rezervare": {
                    "cod": "XFT2K5A4",
                    "operatie": "vanzare",
                    "stare": "activa",
                    "platita": true,
                    "metoda_plata": "card",
                    "asteapta_card": false,
                    "total": 150,
                    "reducere": 0,
                    "de_plata": 150,
                    "moneda": "RON",
                    "plata_pana": null,
                    "creat_la": "2026-10-23 02:14:26",
                    "operator": {
                      "nume": "Carpatica Trans",
                      "slug": "carpatica",
                      "telefon": "0700 000 101"
                    },
                    "canal": "agentie",
                    "contact": {
                      "telefon": "+40722111222",
                      "email": "client@example.ro"
                    },
                    "factura": null,
                    "bilete": [
                      {
                        "cod": "PJ6ZUBM2",
                        "qr": "BB1:PJ6ZUBM2:hyOZbeOG-x2b",
                        "stare": "vandut",
                        "categorie": "adult",
                        "fel": "dus",
                        "pret": 75,
                        "tva_procent": 11,
                        "pasager": "Ion Popescu",
                        "loc": 1,
                        "cursa_id": 57,
                        "traseu": "Constanța – Otopeni",
                        "traseu_cod": "K1",
                        "pleaca": "2026-10-24 04:00",
                        "ajunge": "2026-10-24 08:35",
                        "de": {
                          "statie": "Autogara Sud",
                          "localitate": "Constanța"
                        },
                        "pana": {
                          "statie": "Aeroport Henri Coandă — Sosiri",
                          "localitate": "Otopeni"
                        }
                      },
                      {
                        "cod": "KJM8SC3D",
                        "qr": "BB1:KJM8SC3D:euMZ9sF0WR4Z",
                        "stare": "vandut",
                        "categorie": "adult",
                        "fel": "dus",
                        "pret": 75,
                        "tva_procent": 11,
                        "pasager": "Maria Popescu",
                        "loc": 2,
                        "cursa_id": 57,
                        "traseu": "Constanța – Otopeni",
                        "traseu_cod": "K1",
                        "pleaca": "2026-10-24 04:00",
                        "ajunge": "2026-10-24 08:35",
                        "de": {
                          "statie": "Autogara Sud",
                          "localitate": "Constanța"
                        },
                        "pana": {
                          "statie": "Aeroport Henri Coandă — Sosiri",
                          "localitate": "Otopeni"
                        }
                      }
                    ],
                    "extra": [],
                    "rambursari": []
                  }
                }
              }
            }
          },
          "400": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "401": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "404": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "409": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "429": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          }
        }
      }
    },
    "/rezervari/{cod}/anulare": {
      "post": {
        "summary": "Anulează rezervarea sau bilete",
        "operationId": "anulare",
        "parameters": [
          {
            "name": "cod",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bilete": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                },
                "example": {
                  "ok": true,
                  "rezervare": "XFT2K5A4",
                  "rambursat_total": 150,
                  "linii": [
                    {
                      "bilet": "PJ6ZUBM2",
                      "platit": 75,
                      "retinut": 0,
                      "rambursat": 75,
                      "procent_retinut": 0
                    },
                    {
                      "bilet": "KJM8SC3D",
                      "platit": 75,
                      "retinut": 0,
                      "rambursat": 75,
                      "procent_retinut": 0
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "401": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "404": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "409": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          },
          "429": {
            "description": "Eroare",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Eroare"
                }
              }
            }
          }
        }
      }
    }
  }
}