{
  "openapi": "3.1.1",
  "info": {
    "title": "NorMate API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://normateapitest.vikinggenetics.com/"
    }
  ],
  "paths": {
    "/animal-data": {
      "post": {
        "tags": [
          "AnimalData"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SendAnimalsResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendAnimalsResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendAnimalsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/matings": {
      "post": {
        "tags": [
          "Matings"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CalculateMatingsCommand"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CalculateMatingsCommand"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CalculateMatingsCommand"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/MatingResult"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatingResult"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatingResult"
                }
              }
            }
          }
        }
      }
    },
    "/parameters/genetic-traits/{breed}": {
      "get": {
        "tags": [
          "Parameters"
        ],
        "parameters": [
          {
            "name": "breed",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GeneticTraitInfo"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GeneticTraitInfo"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/GeneticTraitInfo"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/parameters/calculation/{breed}": {
      "get": {
        "tags": [
          "Parameters"
        ],
        "parameters": [
          {
            "name": "breed",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CalcParameterInfo"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CalcParameterInfo"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CalcParameterInfo"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/seges-data/export": {
      "post": {
        "tags": [
          "SegesData"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "pattern": "^-?(?:0|[1-9]\\d*)$",
                  "type": [
                    "integer",
                    "string"
                  ],
                  "format": "int32"
                }
              },
              "application/json": {
                "schema": {
                  "pattern": "^-?(?:0|[1-9]\\d*)$",
                  "type": [
                    "integer",
                    "string"
                  ],
                  "format": "int32"
                }
              },
              "text/json": {
                "schema": {
                  "pattern": "^-?(?:0|[1-9]\\d*)$",
                  "type": [
                    "integer",
                    "string"
                  ],
                  "format": "int32"
                }
              }
            }
          }
        }
      }
    },
    "/seges-data/import": {
      "post": {
        "tags": [
          "SegesData"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AnimalInfo": {
        "required": [
          "id"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "tmi": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "null",
              "number",
              "string"
            ],
            "format": "double"
          },
          "traits": {
            "type": [
              "null",
              "object"
            ],
            "additionalProperties": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "null",
                "integer",
                "string"
              ],
              "format": "int32"
            }
          },
          "geneticTraits": {
            "type": [
              "null",
              "object"
            ],
            "additionalProperties": {
              "pattern": "^-?(?:0|[1-9]\\d*)$",
              "type": [
                "null",
                "integer",
                "string"
              ],
              "format": "uint8"
            }
          }
        }
      },
      "Breed": { },
      "BullInfo": {
        "required": [
          "id"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "minUsage": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "maxUsage": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          }
        }
      },
      "CalcParameterInfo": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "economicValue": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "meanValue": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "null",
              "number",
              "string"
            ],
            "format": "double"
          }
        }
      },
      "CalculateMatingsCommand": {
        "type": "object",
        "properties": {
          "animals": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AnimalInfo"
            }
          },
          "matingGroups": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MatingGroup"
            }
          }
        }
      },
      "CowInfo": {
        "required": [
          "id"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          }
        }
      },
      "ErrorInfo": {
        "required": [
          "idNor",
          "message"
        ],
        "type": "object",
        "properties": {
          "idNor": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "GeneticTraitInfo": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": [
              "null",
              "string"
            ]
          },
          "economicValue": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "minValue": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "maxValue": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "type": {
            "$ref": "#/components/schemas/GeneticTraitType"
          },
          "banned": {
            "type": "boolean"
          },
          "default": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "uint8"
          },
          "isDefect": {
            "type": "boolean"
          }
        }
      },
      "GeneticTraitType": {
        "type": "integer"
      },
      "IdNorBull": { },
      "IdNorCow": { },
      "MatingBull": {
        "required": [
          "id"
        ],
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/IdNorBull"
          },
          "expectedHe": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "null",
              "number",
              "string"
            ],
            "format": "double"
          },
          "inbreeding": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "economicScore": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          }
        }
      },
      "MatingCow": {
        "required": [
          "id"
        ],
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/IdNorCow"
          },
          "bulls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MatingBull"
            }
          },
          "rejectedBulls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RejectedBull"
            }
          }
        }
      },
      "MatingGroup": {
        "required": [
          "breed"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "maxInbreeding": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "minExpectedHe": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "number",
              "string"
            ],
            "format": "double"
          },
          "breed": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Breed"
              }
            ]
          },
          "choices": {
            "maximum": 3,
            "minimum": 1,
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "uint8"
          },
          "targetTmi": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "solverMode": {
            "$ref": "#/components/schemas/SolverMode"
          },
          "cows": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CowInfo"
            }
          },
          "bulls": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BullInfo"
            }
          },
          "traitFilters": {
            "type": [
              "null",
              "array"
            ]
          },
          "geneticTraitFilters": {
            "type": [
              "null",
              "array"
            ]
          }
        }
      },
      "MatingGroupResult": {
        "required": [
          "breed"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": [
              "null",
              "string"
            ]
          },
          "breed": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Breed"
              }
            ]
          },
          "cows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MatingCow"
            }
          },
          "errors": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "MatingResult": {
        "type": "object",
        "properties": {
          "matingGroups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MatingGroupResult"
            }
          }
        }
      },
      "RejectedBull": {
        "required": [
          "id",
          "reason"
        ],
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/IdNorBull"
          },
          "expectedHe": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "null",
              "number",
              "string"
            ],
            "format": "double"
          },
          "inbreeding": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "null",
              "number",
              "string"
            ],
            "format": "double"
          },
          "economicScore": {
            "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
            "type": [
              "null",
              "number",
              "string"
            ],
            "format": "double"
          },
          "reason": {
            "$ref": "#/components/schemas/RejectReason"
          },
          "explanation": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "RejectReason": {
        "type": "integer"
      },
      "SendAnimalsResponse": {
        "required": [
          "added",
          "total"
        ],
        "type": "object",
        "properties": {
          "added": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "total": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "errors": {
            "type": [
              "null",
              "array"
            ],
            "items": {
              "$ref": "#/components/schemas/ErrorInfo"
            }
          }
        }
      },
      "SolverMode": {
        "type": "integer"
      }
    },
    "securitySchemes": {
      "ApiKey": {
        "type": "apiKey",
        "name": "X-ApiKey",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "ApiKey": [ ]
    }
  ],
  "tags": [
    {
      "name": "AnimalData"
    },
    {
      "name": "Matings"
    },
    {
      "name": "Parameters"
    },
    {
      "name": "SegesData"
    }
  ]
}