{
  "openapi": "3.0.4",
  "info": {
    "title": "BookingAvailabilityPlatform.API",
    "version": "1.0"
  },
  "paths": {
    "/api/v1/Schedule/{subscriptionId}/availability": {
      "post": {
        "tags": [
          "Schedule"
        ],
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAvailabilityRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAvailabilityRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAvailabilityRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAvailabilityRequest"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAvailabilityRequest"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAvailabilityRequest"
                }
              }
            }
          }
        },
        "security": [
          { }
        ]
      }
    },
    "/api/v1/Schedule/{subscriptionId}/availability/by-user": {
      "post": {
        "tags": [
          "Schedule"
        ],
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityListRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityListRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AvailabilityListRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityListResponse"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityListResponse"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AvailabilityListResponse"
                }
              }
            }
          }
        },
        "security": [
          { }
        ]
      }
    },
    "/api/v1/Schedule/{subscriptionId}/availability/{id}": {
      "put": {
        "tags": [
          "Schedule"
        ],
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAvailabilityRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAvailabilityRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAvailabilityRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          { }
        ]
      },
      "get": {
        "tags": [
          "Schedule"
        ],
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAvailabilityRequest"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAvailabilityRequest"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAvailabilityRequest"
                }
              }
            }
          }
        },
        "security": [
          { }
        ]
      },
      "delete": {
        "tags": [
          "Schedule"
        ],
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": [
          { }
        ]
      }
    },
    "/api/v1/Test/anonymous/{input}": {
      "get": {
        "tags": [
          "Test"
        ],
        "parameters": [
          {
            "name": "input",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          { }
        ]
      }
    },
    "/api/v1/Test/authorized/{input}": {
      "get": {
        "tags": [
          "Test"
        ],
        "parameters": [
          {
            "name": "input",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          { }
        ]
      }
    },
    "/api/v1/Test/mongo": {
      "get": {
        "tags": [
          "Test"
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionResponse"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionResponse"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionResponse"
                  }
                }
              }
            }
          }
        },
        "security": [
          { }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "Availability": {
        "required": [
          "createdBy",
          "id",
          "modifiedBy"
        ],
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/ObjectId"
          },
          "subscriptionId": {
            "type": "string",
            "nullable": true
          },
          "userId": {
            "type": "string",
            "nullable": true
          },
          "networkId": {
            "type": "string",
            "nullable": true
          },
          "networkName": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "startDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "endDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "timeZone": {
            "type": "string",
            "nullable": true
          },
          "weeklySchedule": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WeeklySchedule"
            },
            "nullable": true
          },
          "overrides": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DateSpecific"
            },
            "nullable": true
          },
          "timeOff": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimeOff"
            },
            "nullable": true
          },
          "metadata": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Metadata"
            },
            "nullable": true
          },
          "reason": {
            "type": "string",
            "nullable": true
          },
          "createdOn": {
            "type": "string",
            "format": "date-time"
          },
          "createdBy": {
            "minLength": 1,
            "type": "string"
          },
          "modifiedOn": {
            "type": "string",
            "format": "date-time"
          },
          "modifiedBy": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "isDeleted": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "AvailabilityListRequest": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "nullable": true
          },
          "networkId": {
            "type": "string",
            "nullable": true
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "sortOrder": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "AvailabilityListResponse": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Availability"
            },
            "nullable": true
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int64"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "activeSchedules": {
            "type": "integer",
            "format": "int32"
          },
          "availableSlotsThisWeek": {
            "type": "integer",
            "format": "int32"
          },
          "activeDaysPerWeek": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "CreateAvailabilityRequest": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "nullable": true
          },
          "networkId": {
            "type": "string",
            "nullable": true
          },
          "networkName": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "type": {
            "type": "string",
            "nullable": true
          },
          "startDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "endDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "timeZone": {
            "type": "string",
            "nullable": true
          },
          "weeklySchedule": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WeeklySchedule"
            },
            "nullable": true
          },
          "overrides": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DateSpecific"
            },
            "nullable": true
          },
          "timeOff": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimeOff"
            },
            "nullable": true
          },
          "metadata": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Metadata"
            },
            "nullable": true
          },
          "reason": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "DateSpecific": {
        "type": "object",
        "properties": {
          "isRecurring": {
            "type": "boolean"
          },
          "startDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "startTime": {
            "type": "string",
            "nullable": true
          },
          "endTime": {
            "type": "string",
            "nullable": true
          },
          "reason": {
            "type": "string",
            "nullable": true
          },
          "recurrence": {
            "$ref": "#/components/schemas/RecurrencePattern"
          }
        },
        "additionalProperties": false
      },
      "Metadata": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ObjectId": {
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "creationTime": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "RecurrencePattern": {
        "type": "object",
        "properties": {
          "interval": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "frequency": {
            "type": "string",
            "nullable": true
          },
          "daysOfWeek": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            },
            "nullable": true
          },
          "endDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "weekOfMonth": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "dayOfWeek": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "dayOfMonth": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ScheduleSlot": {
        "type": "object",
        "properties": {
          "start": {
            "type": "string",
            "nullable": true
          },
          "end": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SubscriptionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "createdBy": {
            "type": "string",
            "nullable": true
          },
          "createdOn": {
            "type": "string",
            "format": "date-time"
          },
          "modifiedBy": {
            "type": "string",
            "nullable": true
          },
          "modifiedOn": {
            "type": "string",
            "format": "date-time"
          }
        },
        "additionalProperties": false
      },
      "TimeOff": {
        "type": "object",
        "properties": {
          "isRecurring": {
            "type": "boolean"
          },
          "startDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "startTime": {
            "type": "string",
            "nullable": true
          },
          "endTime": {
            "type": "string",
            "nullable": true
          },
          "reason": {
            "type": "string",
            "nullable": true
          },
          "recurrence": {
            "$ref": "#/components/schemas/RecurrencePattern"
          }
        },
        "additionalProperties": false
      },
      "WeeklySchedule": {
        "type": "object",
        "properties": {
          "dayOfWeek": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "enabled": {
            "type": "boolean",
            "nullable": true
          },
          "slots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScheduleSlot"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "http",
        "description": "Paste JWT token only (without 'Bearer ' prefix).",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    { }
  ],
  "tags": [
    {
      "name": "Schedule"
    },
    {
      "name": "Test"
    }
  ]
}