#%RAML 1.0 Library
uses:
  health: healthCheck.raml
  check: check.raml
  localVolumes: localVolumes.raml
  numbers: numberTypes.raml
  strings: stringTypes.raml

types:

  NetworkInfoIPAddress:
    type: object
    properties:
      ipAddress: string
      protocol: strings.IpProtocol

  NetworkInfo:
    type: object
    properties:
      hostName: string
      hostPorts: integer[]
      ipAddresses: NetworkInfoIPAddress[]

  Status:
    type: object
    properties:
      stagedAt: datetime
      startedAt?: datetime
      mesosStatus?: string
      condition: strings.Condition
      networkInfo: NetworkInfo

  # Not to be confused with network.IpAddress
  IpAddr:
    type: object
    properties:
      ipAddress: string
      protocol: strings.IpProtocol

  Task:
    type: object
    properties:
      appId: strings.PathId
      healthCheckResults?: health.Health[]
      checkResult?: check.CheckStatus
      host: string
      id: string
      ipAddresses?: IpAddr[]
      ports?: numbers.Port[]
      servicePorts?: numbers.Port[]
      slaveId?: string
      state: strings.MesosTaskState
      stagedAt?: string
      startedAt?: string
      version?: string
      localVolumes?: localVolumes.LocalVolumeId[]
      region?: string
      zone?: string
      role: string

  TaskSingle:
    type: object
    properties:
      task: Task

  TaskList:
    type: object
    properties:
      tasks: Task[]

  TaskStatusCondition:
    type: string
    enum: [ running, staging ]

  TaskFailure:
    type: object
    properties:
      appId: strings.PathId
      host: string
      message: string
      state: string
      taskId: string
      timestamp: datetime
      version: datetime
      slaveId?: string

  TaskCounts:
    type: object
    properties:
      staged:
        type: integer
        format: int32
      running:
        type: integer
        format: int32
      healthy:
        type: integer
        format: int32
      unhealthy:
        type: integer
        format: int32

  TaskLifeTime:
    type: object
    properties:
      averageSeconds: number
      medianSeconds: number

  TaskStats:
    type: object
    properties:
      counts: TaskCounts
      lifeTime?: TaskLifeTime

  Stats:
    type: object
    properties:
      stats: TaskStats

  TaskStatsByVersion:
    type: object
    properties:
      startedAfterLastScaling?: Stats
      withLatestConfig?: Stats
      withOutdatedConfig?: Stats
      totalSummary?: Stats
