{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ingest.profit-base.online/exchange/v1/schemas/ship.schema.json",
  "title": "Ship",
  "description": "One of the member's own ships. Purchase data is never exchanged.",
  "type": "object",
  "properties": {
    "shipId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "Opaque identifier issued by the Basetool. Clients store and echo it, never parse it."
    },
    "externalId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "The client's id for this ship, once linked."
    },
    "version": {
      "type": "integer",
      "minimum": 0
    },
    "shipType": {
      "$ref": "item-ref.schema.json"
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255,
      "description": "The member's name for the ship; absent when it has none."
    },
    "insurance": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "LTI",
            "MONTHS"
          ]
        },
        "months": {
          "type": "integer",
          "minimum": 0,
          "maximum": 120
        }
      },
      "required": [
        "kind"
      ],
      "if": {
        "properties": {
          "kind": {
            "const": "MONTHS"
          }
        }
      },
      "then": {
        "required": [
          "months"
        ]
      }
    },
    "location": {
      "$ref": "location-ref.schema.json"
    },
    "fitted": {
      "type": "boolean"
    },
    "orgUnit": {
      "$ref": "org-unit.schema.json",
      "description": "The org unit the ship belongs to; absent when it belongs to none."
    },
    "orgUnitVersion": {
      "type": "integer",
      "minimum": 0,
      "description": "The counter of the ship's org unit, separate from version: a change of the unit moves it, an edit of the other fields does not."
    },
    "extensions": {
      "$ref": "extensions.schema.json"
    }
  },
  "required": [
    "shipId",
    "version",
    "shipType",
    "insurance",
    "fitted"
  ]
}
