swagger: '2.0'
info:
  title: Egypt Metro API
  description: API documentation for Metro application
  termsOfService: https://www.google.com/policies/terms/
  contact:
    email: a.moh.nassar00@gmail.com
  license:
    name: MIT License
    url: https://opensource.org/licenses/MIT
  version: v1
host: backend-54v5.onrender.com
schemes:
- https
basePath: /api
consumes:
- application/json
produces:
- application/json
securityDefinitions:
  Basic:
    type: basic
  Bearer:
    type: apiKey
    name: Authorization
    in: header
security:
- Basic: []
- Bearer: []
paths:
  /auth/password/reset/confirm/:
    post:
      operationId: auth_password_reset_confirm_create
      description: ''
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - auth
    parameters: []
  /auth/password/reset/request/:
    post:
      operationId: auth_password_reset_request_create
      description: ''
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - auth
    parameters: []
  /auth/password/reset/validate/:
    post:
      operationId: auth_password_reset_validate_create
      description: ''
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - auth
    parameters: []
  /dashboard/api/alerts/:
    get:
      operationId: dashboard_api_alerts_list
      description: System alerts management
      parameters:
      - name: search
        in: query
        description: A search term.
        required: false
        type: string
      - name: ordering
        in: query
        description: Which field to use when ordering the results.
        required: false
        type: string
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/SystemAlert'
      tags:
      - dashboard
    post:
      operationId: dashboard_api_alerts_create
      description: System alerts management
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/SystemAlert'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/SystemAlert'
      tags:
      - dashboard
    parameters: []
  /dashboard/api/alerts/{id}/:
    get:
      operationId: dashboard_api_alerts_read
      description: System alerts management
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/SystemAlert'
      tags:
      - dashboard
    put:
      operationId: dashboard_api_alerts_update
      description: System alerts management
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/SystemAlert'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/SystemAlert'
      tags:
      - dashboard
    patch:
      operationId: dashboard_api_alerts_partial_update
      description: System alerts management
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/SystemAlert'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/SystemAlert'
      tags:
      - dashboard
    delete:
      operationId: dashboard_api_alerts_delete
      description: System alerts management
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - dashboard
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this System Alert.
      required: true
      type: integer
  /dashboard/api/dashboard/:
    get:
      operationId: dashboard_api_dashboard_list
      description: Comprehensive admin dashboard viewset
      parameters:
      - name: search
        in: query
        description: A search term.
        required: false
        type: string
      - name: ordering
        in: query
        description: Which field to use when ordering the results.
        required: false
        type: string
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/AdminMetrics'
      tags:
      - dashboard
    post:
      operationId: dashboard_api_dashboard_create
      description: Comprehensive admin dashboard viewset
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/AdminMetrics'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/AdminMetrics'
      tags:
      - dashboard
    parameters: []
  /dashboard/api/dashboard/analytics/:
    get:
      operationId: dashboard_api_dashboard_analytics
      description: Provide comprehensive analytics
      parameters:
      - name: search
        in: query
        description: A search term.
        required: false
        type: string
      - name: ordering
        in: query
        description: Which field to use when ordering the results.
        required: false
        type: string
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/AdminMetrics'
      tags:
      - dashboard
    parameters: []
  /dashboard/api/dashboard/metrics/:
    get:
      operationId: dashboard_api_dashboard_metrics_list
      description: Comprehensive admin dashboard viewset
      parameters:
      - name: search
        in: query
        description: A search term.
        required: false
        type: string
      - name: ordering
        in: query
        description: Which field to use when ordering the results.
        required: false
        type: string
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/AdminMetrics'
      tags:
      - dashboard
    parameters: []
  /dashboard/api/dashboard/{id}/:
    get:
      operationId: dashboard_api_dashboard_read
      description: Comprehensive admin dashboard viewset
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/AdminMetrics'
      tags:
      - dashboard
    put:
      operationId: dashboard_api_dashboard_update
      description: Comprehensive admin dashboard viewset
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/AdminMetrics'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/AdminMetrics'
      tags:
      - dashboard
    patch:
      operationId: dashboard_api_dashboard_partial_update
      description: Comprehensive admin dashboard viewset
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/AdminMetrics'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/AdminMetrics'
      tags:
      - dashboard
    delete:
      operationId: dashboard_api_dashboard_delete
      description: Comprehensive admin dashboard viewset
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - dashboard
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this Admin Metric.
      required: true
      type: integer
  /dashboard/api/reports/:
    get:
      operationId: dashboard_api_reports_list
      description: Report generation management
      parameters:
      - name: search
        in: query
        description: A search term.
        required: false
        type: string
      - name: ordering
        in: query
        description: Which field to use when ordering the results.
        required: false
        type: string
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/ReportGeneration'
      tags:
      - dashboard
    post:
      operationId: dashboard_api_reports_create
      description: Report generation management
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/ReportGeneration'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/ReportGeneration'
      tags:
      - dashboard
    parameters: []
  /dashboard/api/reports/{id}/:
    get:
      operationId: dashboard_api_reports_read
      description: Report generation management
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/ReportGeneration'
      tags:
      - dashboard
    put:
      operationId: dashboard_api_reports_update
      description: Report generation management
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/ReportGeneration'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/ReportGeneration'
      tags:
      - dashboard
    patch:
      operationId: dashboard_api_reports_partial_update
      description: Report generation management
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/ReportGeneration'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/ReportGeneration'
      tags:
      - dashboard
    delete:
      operationId: dashboard_api_reports_delete
      description: Report generation management
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - dashboard
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this Report Generation.
      required: true
      type: integer
  /dashboard/api/revenue/breakdown/:
    get:
      operationId: dashboard_api_revenue_revenue_breakdown
      description: Get comprehensive revenue breakdown
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - dashboard
    parameters: []
  /dashboard/api/revenue/predictions/:
    get:
      operationId: dashboard_api_revenue_revenue_predictions
      description: Get revenue predictions
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - dashboard
    parameters: []
  /dashboard/api/revenue/revenue_breakdown/:
    get:
      operationId: dashboard_api_revenue_revenue_breakdown
      description: Get comprehensive revenue breakdown
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - dashboard
    parameters: []
  /dashboard/api/revenue/revenue_predictions/:
    get:
      operationId: dashboard_api_revenue_revenue_predictions
      description: Get revenue predictions
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - dashboard
    parameters: []
  /docs/:
    get:
      operationId: docs_list
      description: ''
      parameters: []
      responses:
        '200':
          description: ''
      produces: []
      tags:
      - docs
    parameters: []
  /routes/find/:
    get:
      operationId: routes_find_list
      summary: API endpoint for finding routes between metro stations.
      description: |-
        GET Parameters:
            start (str): Name of the starting station
            end (str): Name of the destination station
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - routes
    parameters: []
  /schema/:
    get:
      operationId: schema_list
      summary: OpenApi3 schema for this API. Format can be selected via content negotiation.
      description: |-
        - YAML: application/vnd.oai.openapi
        - JSON: application/vnd.oai.openapi+json
      parameters: []
      responses:
        '200':
          description: ''
      produces:
      - application/vnd.oai.openapi
      - application/yaml
      - application/vnd.oai.openapi+json
      - application/json
      tags:
      - schema
    parameters: []
  /stations/list/:
    get:
      operationId: stations_list_list
      description: ''
      parameters:
      - name: search
        in: query
        description: A search term.
        required: false
        type: string
      - name: ordering
        in: query
        description: Which field to use when ordering the results.
        required: false
        type: string
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      - name: page_size
        in: query
        description: Number of results to return per page.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/Station'
      tags:
      - stations
    parameters: []
  /stations/nearest/:
    get:
      operationId: stations_nearest_list
      description: Finds the nearest station to the user's location.
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - stations
    post:
      operationId: stations_nearest_create
      description: Finds the nearest station to the user's location.
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - stations
    parameters: []
  /stations/trip/{start_station_id}/{end_station_id}/:
    get:
      operationId: stations_trip_read
      description: Provides trip details between two stations, including ticket price,
        travel time, and distance.
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - stations
    parameters:
    - name: start_station_id
      in: path
      required: true
      type: string
    - name: end_station_id
      in: path
      required: true
      type: string
  /trains/:
    get:
      operationId: trains_list
      summary: ViewSet for managing train operations and schedules.
      description: |-
        Provides endpoints for:
        - Train schedules retrieval
        - Crowd level monitoring
        - Train location updates
        - Debug information

        Public Endpoints:
        - GET /api/trains/ - List all trains
        - GET /api/trains/{id}/ - Get train details
        - POST /api/trains/get-schedules/ - Get upcoming schedules
        - GET /api/trains/debug/ - Get API debug info
        - GET /api/trains/{id}/station-schedule/ - Get station schedule

        Protected Endpoints (require authentication):
        - POST /api/trains/{id}/update-crowd-level/ - Update crowd level
        - POST /api/trains/{id}/update-location/ - Update train location
        - POST /api/trains/ - Create new train
        - PUT/PATCH /api/trains/{id}/ - Update train
        - DELETE /api/trains/{id}/ - Delete train
      parameters:
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      - name: page_size
        in: query
        description: Number of results to return per page.
        required: false
        type: integer
      responses:
        '200':
          description: ''
          schema:
            required:
            - count
            - results
            type: object
            properties:
              count:
                type: integer
              next:
                type: string
                format: uri
                x-nullable: true
              previous:
                type: string
                format: uri
                x-nullable: true
              results:
                type: array
                items:
                  $ref: '#/definitions/Train'
      tags:
      - trains
    post:
      operationId: trains_create
      summary: ViewSet for managing train operations and schedules.
      description: |-
        Provides endpoints for:
        - Train schedules retrieval
        - Crowd level monitoring
        - Train location updates
        - Debug information

        Public Endpoints:
        - GET /api/trains/ - List all trains
        - GET /api/trains/{id}/ - Get train details
        - POST /api/trains/get-schedules/ - Get upcoming schedules
        - GET /api/trains/debug/ - Get API debug info
        - GET /api/trains/{id}/station-schedule/ - Get station schedule

        Protected Endpoints (require authentication):
        - POST /api/trains/{id}/update-crowd-level/ - Update crowd level
        - POST /api/trains/{id}/update-location/ - Update train location
        - POST /api/trains/ - Create new train
        - PUT/PATCH /api/trains/{id}/ - Update train
        - DELETE /api/trains/{id}/ - Delete train
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/Train'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/Train'
      tags:
      - trains
    parameters: []
  /trains/debug/:
    get:
      operationId: trains_debug_info
      description: Get API debug information
      parameters:
      - name: page
        in: query
        description: A page number within the paginated result set.
        required: false
        type: integer
      - name: page_size
        in: query
        description: Number of results to return per page.
        required: false
        type: integer
      responses:
        '200':
          description: Debug information
          schema:
            type: object
            properties:
              api_status:
                type: string
              version:
                type: string
              available_actions:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    method:
                      type: string
                    url:
                      type: string
                    description:
                      type: string
                    requires_auth:
                      type: boolean
                    parameters:
                      type: array
                      items:
                        type: string
              registered_urls:
                type: object
                additionalProperties:
                  type: string
              authentication_required:
                type: boolean
              supported_methods:
                type: array
                items:
                  type: string
              documentation_url:
                type: string
        '400':
          description: Bad Request
        '500':
          description: Internal Server Error
      tags:
      - Debug
    parameters: []
  /trains/get-schedules/:
    post:
      operationId: trains_get_schedules
      description: Get upcoming train schedules between stations
      parameters:
      - name: data
        in: body
        required: true
        schema:
          required:
          - start_station
          - end_station
          type: object
          properties:
            start_station:
              description: Starting station ID
              type: integer
            end_station:
              description: Destination station ID
              type: integer
      responses:
        '200':
          description: ''
          schema:
            type: array
            items:
              $ref: '#/definitions/Schedule'
        '400':
          description: Bad Request
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
      tags:
      - Schedules
    parameters: []
  /trains/{id}/:
    get:
      operationId: trains_read
      summary: ViewSet for managing train operations and schedules.
      description: |-
        Provides endpoints for:
        - Train schedules retrieval
        - Crowd level monitoring
        - Train location updates
        - Debug information

        Public Endpoints:
        - GET /api/trains/ - List all trains
        - GET /api/trains/{id}/ - Get train details
        - POST /api/trains/get-schedules/ - Get upcoming schedules
        - GET /api/trains/debug/ - Get API debug info
        - GET /api/trains/{id}/station-schedule/ - Get station schedule

        Protected Endpoints (require authentication):
        - POST /api/trains/{id}/update-crowd-level/ - Update crowd level
        - POST /api/trains/{id}/update-location/ - Update train location
        - POST /api/trains/ - Create new train
        - PUT/PATCH /api/trains/{id}/ - Update train
        - DELETE /api/trains/{id}/ - Delete train
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/TrainDetail'
      tags:
      - trains
    put:
      operationId: trains_update
      summary: ViewSet for managing train operations and schedules.
      description: |-
        Provides endpoints for:
        - Train schedules retrieval
        - Crowd level monitoring
        - Train location updates
        - Debug information

        Public Endpoints:
        - GET /api/trains/ - List all trains
        - GET /api/trains/{id}/ - Get train details
        - POST /api/trains/get-schedules/ - Get upcoming schedules
        - GET /api/trains/debug/ - Get API debug info
        - GET /api/trains/{id}/station-schedule/ - Get station schedule

        Protected Endpoints (require authentication):
        - POST /api/trains/{id}/update-crowd-level/ - Update crowd level
        - POST /api/trains/{id}/update-location/ - Update train location
        - POST /api/trains/ - Create new train
        - PUT/PATCH /api/trains/{id}/ - Update train
        - DELETE /api/trains/{id}/ - Delete train
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/Train'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/Train'
      tags:
      - trains
    patch:
      operationId: trains_partial_update
      summary: ViewSet for managing train operations and schedules.
      description: |-
        Provides endpoints for:
        - Train schedules retrieval
        - Crowd level monitoring
        - Train location updates
        - Debug information

        Public Endpoints:
        - GET /api/trains/ - List all trains
        - GET /api/trains/{id}/ - Get train details
        - POST /api/trains/get-schedules/ - Get upcoming schedules
        - GET /api/trains/debug/ - Get API debug info
        - GET /api/trains/{id}/station-schedule/ - Get station schedule

        Protected Endpoints (require authentication):
        - POST /api/trains/{id}/update-crowd-level/ - Update crowd level
        - POST /api/trains/{id}/update-location/ - Update train location
        - POST /api/trains/ - Create new train
        - PUT/PATCH /api/trains/{id}/ - Update train
        - DELETE /api/trains/{id}/ - Delete train
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/Train'
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/Train'
      tags:
      - trains
    delete:
      operationId: trains_delete
      summary: ViewSet for managing train operations and schedules.
      description: |-
        Provides endpoints for:
        - Train schedules retrieval
        - Crowd level monitoring
        - Train location updates
        - Debug information

        Public Endpoints:
        - GET /api/trains/ - List all trains
        - GET /api/trains/{id}/ - Get train details
        - POST /api/trains/get-schedules/ - Get upcoming schedules
        - GET /api/trains/debug/ - Get API debug info
        - GET /api/trains/{id}/station-schedule/ - Get station schedule

        Protected Endpoints (require authentication):
        - POST /api/trains/{id}/update-crowd-level/ - Update crowd level
        - POST /api/trains/{id}/update-location/ - Update train location
        - POST /api/trains/ - Create new train
        - PUT/PATCH /api/trains/{id}/ - Update train
        - DELETE /api/trains/{id}/ - Delete train
      parameters: []
      responses:
        '204':
          description: ''
      tags:
      - trains
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this train.
      required: true
      type: integer
  /trains/{id}/station-schedule/:
    get:
      operationId: trains_station_schedule
      description: Get schedule for a specific station
      parameters: []
      responses:
        '200':
          description: ''
          schema:
            $ref: '#/definitions/Train'
      tags:
      - trains
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this train.
      required: true
      type: integer
  /trains/{id}/update-crowd-level/:
    post:
      operationId: trains_update_crowd_level
      description: Comprehensive crowd level update endpoint
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/TrainDetail'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/TrainDetail'
      tags:
      - trains
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this train.
      required: true
      type: integer
  /trains/{id}/update-location/:
    post:
      operationId: trains_update_location
      summary: ViewSet for managing train operations and schedules.
      description: |-
        Provides endpoints for:
        - Train schedules retrieval
        - Crowd level monitoring
        - Train location updates
        - Debug information

        Public Endpoints:
        - GET /api/trains/ - List all trains
        - GET /api/trains/{id}/ - Get train details
        - POST /api/trains/get-schedules/ - Get upcoming schedules
        - GET /api/trains/debug/ - Get API debug info
        - GET /api/trains/{id}/station-schedule/ - Get station schedule

        Protected Endpoints (require authentication):
        - POST /api/trains/{id}/update-crowd-level/ - Update crowd level
        - POST /api/trains/{id}/update-location/ - Update train location
        - POST /api/trains/ - Create new train
        - PUT/PATCH /api/trains/{id}/ - Update train
        - DELETE /api/trains/{id}/ - Delete train
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/Train'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/Train'
      tags:
      - trains
    parameters:
    - name: id
      in: path
      description: A unique integer value identifying this train.
      required: true
      type: integer
  /users/login/:
    post:
      operationId: users_login_create
      description: Handle user login with rate limiting and security features
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - users
    parameters: []
  /users/profile/:
    get:
      operationId: users_profile_list
      description: Handle user profile operations with caching
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - users
    parameters: []
  /users/profile/update/:
    patch:
      operationId: users_profile_update_partial_update
      description: Handle profile updates with validation
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - users
    parameters: []
  /users/register/:
    post:
      operationId: users_register_create
      description: Handle user registration with enhanced security and validation
      parameters: []
      responses:
        '201':
          description: ''
      tags:
      - users
    parameters: []
  /users/superusers/:
    get:
      operationId: users_superusers_list
      description: Get list of superusers with caching.
      parameters: []
      responses:
        '200':
          description: ''
      tags:
      - users
    parameters: []
  /users/token/refresh/:
    post:
      operationId: users_token_refresh_create
      description: |-
        Takes a refresh type JSON web token and returns an access type JSON web
        token if the refresh token is valid.
      parameters:
      - name: data
        in: body
        required: true
        schema:
          $ref: '#/definitions/TokenRefresh'
      responses:
        '201':
          description: ''
          schema:
            $ref: '#/definitions/TokenRefresh'
      tags:
      - users
    parameters: []
definitions:
  SystemAlert:
    required:
    - title
    - description
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      title:
        title: Alert Title
        description: Concise alert title
        type: string
        maxLength: 255
        minLength: 1
      description:
        title: Alert Description
        description: Detailed alert information
        type: string
        minLength: 1
      level:
        title: Alert Level
        type: string
        enum:
        - info
        - warning
        - critical
        - emergency
      created_at:
        title: Created At
        type: string
        format: date-time
        readOnly: true
      resolved_at:
        title: Resolved At
        type: string
        format: date-time
        readOnly: true
        x-nullable: true
      is_resolved:
        title: Resolved
        type: boolean
      created_by:
        title: Created by
        type: integer
        readOnly: true
        x-nullable: true
      resolved_by:
        title: Resolved by
        type: integer
        readOnly: true
        x-nullable: true
  AdminMetrics:
    required:
    - total_passengers
    - total_revenue
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      date:
        title: Metric Date
        type: string
        format: date
        readOnly: true
      metric_type:
        title: Metric Type
        type: string
        enum:
        - daily
        - weekly
        - monthly
        default: daily
      total_passengers:
        title: Total Passengers
        description: Total number of passengers for the period
        type: integer
        maximum: 2147483647
        minimum: 0
      total_revenue:
        title: Total Revenue
        description: Total revenue generated
        type: string
        format: decimal
      line_performance:
        title: Line Performance
        description: Detailed performance metrics per metro line
        type: object
  ReportGeneration:
    required:
    - report_type
    - start_date
    - end_date
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      report_type:
        title: Report Type
        type: string
        enum:
        - daily_passenger
        - monthly_revenue
        - line_performance
        - system_health
      start_date:
        title: Start Date
        type: string
        format: date
      end_date:
        title: End Date
        type: string
        format: date
      generated_at:
        title: Generated At
        type: string
        format: date-time
        readOnly: true
      file_path:
        title: Report File Path
        type: string
        enum:
        - ''
        readOnly: true
        x-nullable: true
      generated_by:
        title: Generated by
        type: integer
        x-nullable: true
  Line:
    required:
    - name
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      name:
        title: Name
        type: string
        maxLength: 255
        minLength: 1
  Station:
    required:
    - name
    - lines
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      name:
        title: Name
        type: string
        maxLength: 255
        minLength: 1
      lines:
        type: array
        items:
          $ref: '#/definitions/Line'
  Train:
    required:
    - train_number
    - direction
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      train_number:
        title: Train number
        type: string
        maxLength: 50
        minLength: 1
      line_name:
        title: Line name
        type: string
        readOnly: true
        minLength: 1
      status:
        title: Status
        type: string
        enum:
        - IN_SERVICE
        - DELAYED
        - MAINTENANCE
        - OUT_OF_SERVICE
      has_ac:
        title: Has ac
        type: boolean
      direction:
        title: Direction
        type: string
        enum:
        - HELWAN
        - MARG
        - SHOBRA
        - MONIB
        - ADLY
        - KIT_KAT
      current_station_name:
        title: Current station name
        type: string
        readOnly: true
        minLength: 1
      next_station_name:
        title: Next station name
        type: string
        readOnly: true
        minLength: 1
      camera_car_number:
        title: Camera car number
        type: integer
        maximum: 2147483647
        minimum: 0
        x-nullable: true
  Schedule:
    required:
    - train_number
    - direction
    - arrival_time
    - departure_time
    - has_ac
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      train_number:
        title: Train number
        type: string
        minLength: 1
      direction:
        title: Direction
        type: string
        minLength: 1
      arrival_time:
        title: Arrival time
        type: string
        format: date-time
      departure_time:
        title: Departure time
        type: string
        format: date-time
      status:
        title: Status
        type: string
        enum:
        - IN_SERVICE
        - DELAYED
        - MAINTENANCE
        - OUT_OF_SERVICE
      has_ac:
        title: Has ac
        type: boolean
      crowd_level:
        title: Crowd level
        type: string
        readOnly: true
      passenger_count:
        title: Passenger count
        type: string
        readOnly: true
      line:
        title: Line
        type: string
        readOnly: true
      monitored_car:
        title: Monitored car
        type: string
        readOnly: true
  TrainCar:
    required:
    - car_number
    type: object
    properties:
      car_number:
        title: Car number
        type: integer
        maximum: 2147483647
        minimum: 0
      has_camera:
        title: Has camera
        type: boolean
      current_passengers:
        title: Current passengers
        type: integer
        maximum: 2147483647
        minimum: 0
      crowd_level:
        title: Crowd level
        type: string
        enum:
        - EMPTY
        - LOW
        - MEDIUM
        - HIGH
        - FULL
  TrainDetail:
    required:
    - train_number
    - direction
    type: object
    properties:
      id:
        title: ID
        type: integer
        readOnly: true
      train_number:
        title: Train number
        type: string
        maxLength: 50
        minLength: 1
      line_name:
        title: Line name
        type: string
        readOnly: true
        minLength: 1
      status:
        title: Status
        type: string
        enum:
        - IN_SERVICE
        - DELAYED
        - MAINTENANCE
        - OUT_OF_SERVICE
      has_ac:
        title: Has ac
        type: boolean
      direction:
        title: Direction
        type: string
        enum:
        - HELWAN
        - MARG
        - SHOBRA
        - MONIB
        - ADLY
        - KIT_KAT
      current_station_name:
        title: Current station name
        type: string
        readOnly: true
        minLength: 1
      next_station_name:
        title: Next station name
        type: string
        readOnly: true
        minLength: 1
      camera_car_number:
        title: Camera car number
        type: integer
        maximum: 2147483647
        minimum: 0
        x-nullable: true
      cars:
        type: array
        items:
          $ref: '#/definitions/TrainCar'
        readOnly: true
  TokenRefresh:
    required:
    - refresh
    type: object
    properties:
      refresh:
        title: Refresh
        type: string
        minLength: 1
      access:
        title: Access
        type: string
        readOnly: true
        minLength: 1
