{
  "openapi": "3.0.4",
  "info": {
    "title": "STB Playbook API",
    "version": "v1"
  },
  "paths": {
    "/api/playbook-estimates": {
      "get": {
        "tags": [
          "Playbook Estimates"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.read, stbplaybook.write.",
        "operationId": "GetAllPlaybookEstimates",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PlaybookEstimateDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      },
      "post": {
        "tags": [
          "Playbook Estimates"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.write.",
        "operationId": "CreatePlaybookEstimate",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlaybookEstimateDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookEstimateDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/playbook-estimates/region/{region}": {
      "get": {
        "tags": [
          "Playbook Estimates"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.read, stbplaybook.write.",
        "operationId": "GetPlaybookEstimatesByRegion",
        "parameters": [
          {
            "name": "region",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PlaybookEstimateDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/playbook-estimates/{id}": {
      "get": {
        "tags": [
          "Playbook Estimates"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.read, stbplaybook.write.",
        "operationId": "GetPlaybookEstimateById",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookEstimateDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      },
      "put": {
        "tags": [
          "Playbook Estimates"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.write.",
        "operationId": "UpdatePlaybookEstimate",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlaybookEstimateDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookEstimateDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      },
      "delete": {
        "tags": [
          "Playbook Estimates"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.write.",
        "operationId": "DeletePlaybookEstimate",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/playbook-estimates/filters/basins": {
      "get": {
        "tags": [
          "Playbook Estimates"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.read, stbplaybook.write.",
        "operationId": "GetUniqueBasins",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/playbook-estimates/filters/dev-areas": {
      "get": {
        "tags": [
          "Playbook Estimates"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.read, stbplaybook.write.",
        "operationId": "GetUniqueDevAreas",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/approvals": {
      "get": {
        "tags": [
          "Region Approvals"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.read, stbplaybook.write.",
        "operationId": "GetAllApprovals",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApprovalSummaryDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      },
      "post": {
        "tags": [
          "Region Approvals"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.write.",
        "operationId": "CreateApproval",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApprovalSummaryDto"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalSummaryDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/approvals/region/{regionName}": {
      "get": {
        "tags": [
          "Region Approvals"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.read, stbplaybook.write.",
        "operationId": "GetApprovalByRegion",
        "parameters": [
          {
            "name": "regionName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalSummaryDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/approvals/{regionName}/decision": {
      "patch": {
        "tags": [
          "Region Approvals"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.write.",
        "operationId": "UpdateApprovalDecision",
        "parameters": [
          {
            "name": "regionName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApprovalDecisionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApprovalSummaryDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/approvals/status/all-approved": {
      "get": {
        "tags": [
          "Region Approvals"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.read, stbplaybook.write.",
        "operationId": "CheckAllApproved",
        "responses": {
          "200": {
            "description": "OK"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/regions": {
      "get": {
        "tags": [
          "Regions"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.read, stbplaybook.write.",
        "operationId": "GetAllRegions",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/RegionSummaryDto"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/regions/name/{name}": {
      "get": {
        "tags": [
          "Regions"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.read, stbplaybook.write.",
        "operationId": "GetRegionByName",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RegionSummaryDto"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "tags": [
          "StbPlaybookApi"
        ],
        "operationId": "HealthCheck",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/playbook/bootstrap": {
      "get": {
        "tags": [
          "StbPlaybookApi"
        ],
        "description": "Required CAL delegated scopes: stbplaybook.read, stbplaybook.write.",
        "operationId": "GetPlaybookBootstrap",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookBootstrapResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ApprovalDecisionRequest": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "nullable": true
          },
          "comment": {
            "type": "string",
            "nullable": true
          },
          "approvedBy": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ApprovalSummaryDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "region": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "comment": {
            "type": "string",
            "nullable": true
          },
          "submittedBy": {
            "type": "string",
            "nullable": true
          },
          "submittedOn": {
            "type": "string",
            "format": "date-time"
          },
          "approvedBy": {
            "type": "string",
            "nullable": true
          },
          "approvedTimestamp": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PlaybookBootstrapResponse": {
        "type": "object",
        "properties": {
          "estimates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlaybookEstimateDto"
            },
            "nullable": true
          },
          "regions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RegionSummaryDto"
            },
            "nullable": true
          },
          "approvals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApprovalSummaryDto"
            },
            "nullable": true
          },
          "developmentAreas": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PlaybookEstimateDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "wellDesignType": {
            "type": "string",
            "nullable": true
          },
          "maturityIndex": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "typeWellsDrilled": {
            "type": "string",
            "nullable": true
          },
          "basin": {
            "type": "string",
            "nullable": true
          },
          "cAndDArea": {
            "type": "string",
            "nullable": true
          },
          "developmentArea": {
            "type": "string",
            "nullable": true
          },
          "mudiReservoir": {
            "type": "string",
            "nullable": true
          },
          "lateralLengthFt": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "measuredDepthFt": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "rigMoveDays": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "drillingFeetFt": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "drillDays": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "totalDrillingWaterBbls": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "mobCostK": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "drillingCost": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "drillDaysCostEvNoGandAK": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "firstPiFactorDays": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "firstPiFactorCost": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "secondPiFactorDays": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "secondPiFactorCost": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "region": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "RegionSummaryDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "wells": {
            "type": "integer",
            "format": "int32"
          },
          "devAreas": {
            "type": "integer",
            "format": "int32"
          },
          "updated": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "description": "CAL bearer token. Delegated read scopes: stbplaybook.read, stbplaybook.write. Delegated write scopes: stbplaybook.write. Configured app roles: .",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "tags": [
    {
      "name": "Playbook Estimates"
    },
    {
      "name": "Region Approvals"
    },
    {
      "name": "Regions"
    },
    {
      "name": "StbPlaybookApi"
    }
  ]
}