swagger: "2.0"
info:
  description: "Parses text logs into logsect objects."
  version: "1.0.0"
  title: "logsect-svc"
  contact:
    name: "Infra"
    email: "infrateam@zoox.com"
    url: "https://git.zooxlabs.com/zooxco/driving"

basePath: "/api/v1"

schemes:
  - "https"

paths:
  "/url/{url}":
    get:
      summary: "Parse the text log at the given URL into a logsect object."
      description: ""
      operationId: "base.logsect.server.get_url"
      produces:
        - "application/json"
      parameters:
        - name: "url"
          in: "path"
          description: "URL to retrieve text log from"
          required: true
          type: "string"
          format: "path"
      responses:
        "200":
          description: "Successful operation"
          schema:
            $ref: "#/definitions/Log"
        "422":
          description: "Invalid parameter"
          schema:
            $ref: "#/definitions/ErrorResponse"
        "500":
          description: "Internal server error"
          schema:
            $ref: "#/definitions/ErrorResponse"

definitions:
  ErrorResponse:
    type: "object"
    properties:
      message:
        description: "A message describing the error"
        type: "string"

  Log:
    type: "object"
    properties:
      title:
        description: "Log title object"
        $ref: "#/definitions/Title"
      meta_data:
        description: "Log metadata"
        type: "array"
        items:
          $ref: "#/definitions/MetaData"
      results:
        description: "Log results"
        type: "array"
        items:
          $ref: "#/definitions/Result"
      sections:
        description: "Log sections"
        type: "array"
        items:
          $ref: "#/definitions/Section"

  Title:
    type: "object"
    properties:
      title:
        description: "Title of log"
        type: "string"
      url:
        description: "URL of log"
        type: "string"

  MetaData:
    type: "object"
    properties:
      key:
        description: "Meta data key"
        type: "string"
      value:
        description: "Meta data value"
        type: "string"
      url:
        description: "URL of log"
        type: "string"

  Result:
    type: "object"
    properties:
      name:
        description: "Result name"
        type: "string"
      status:
        description: "Result status"
        $ref: "#/definitions/ResultStatus"
      text:
        description: "Result text"
        type: "string"
      url:
        description: "Result URL"
        type: "string"

  ResultStatus:
    description: "Result statuses"
    type: "string"
    enum:
      - "success"
      - "info"
      - "warning"
      - "error"

  Section:
    type: "object"
    properties:
      name:
        description: "Section name"
        type: "string"
      text:
        description: "Section text"
        type: "string"
      line_count:
        description: "Number of lines in text"
        type: "integer"
      time:
        description: "Start time for section in epoch seconds"
        type: "integer"
        format: "int64"
