{
  "openapi": "3.0.4",
  "info": {
    "title": "PatientScheduler.Api",
    "version": "1.0"
  },
  "paths": {
    "/appointments": {
      "post": {
        "tags": [
          "Appointment"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientScheduler.Api.Features.AppointmentScheduling.AppointmentScheduleRequestModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientScheduler.Api.Features.AppointmentScheduling.AppointmentScheduleRequestModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PatientScheduler.Api.Features.AppointmentScheduling.AppointmentScheduleRequestModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.AppointmentScheduling.AppointmentConfirmationViewModel"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.AppointmentScheduling.AppointmentConfirmationViewModel"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.AppointmentScheduling.AppointmentConfirmationViewModel"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/appointments/verification": {
      "put": {
        "tags": [
          "Appointment"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientScheduler.Api.Features.Appointment.Verification.AppointmentVerificationRequestModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientScheduler.Api.Features.Appointment.Verification.AppointmentVerificationRequestModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PatientScheduler.Api.Features.Appointment.Verification.AppointmentVerificationRequestModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Appointment.Verification.AppointmentViewModel"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Appointment.Verification.AppointmentViewModel"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Appointment.Verification.AppointmentViewModel"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/appointments/cancellation": {
      "put": {
        "tags": [
          "Appointment"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientScheduler.Api.Features.Appointment.Cancellation.AppointmentCancellationRequestModel"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/PatientScheduler.Api.Features.Appointment.Cancellation.AppointmentCancellationRequestModel"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/PatientScheduler.Api.Features.Appointment.Cancellation.AppointmentCancellationRequestModel"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/locations": {
      "get": {
        "tags": [
          "Location"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.LocationViewModel"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.LocationViewModel"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.LocationViewModel"
                }
              }
            }
          }
        }
      }
    },
    "/locations/available-appointments": {
      "get": {
        "tags": [
          "Location"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.AvailableAppointmentsViewModel"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.AvailableAppointmentsViewModel"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.AvailableAppointmentsViewModel"
                }
              }
            }
          }
        }
      }
    },
    "/locations/{locationId}/schedule-slots": {
      "get": {
        "tags": [
          "Location"
        ],
        "parameters": [
          {
            "name": "LocationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "days",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.State.ScheduleViewModel"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.State.ScheduleViewModel"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.State.ScheduleViewModel"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/messages": {
      "get": {
        "tags": [
          "Message"
        ],
        "parameters": [
          {
            "name": "t",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/PatientScheduler.Domain.DomainModel.Enums.MessageType"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PatientScheduler.Api.Features.Message.MessageViewModel"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PatientScheduler.Api.Features.Message.MessageViewModel"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PatientScheduler.Api.Features.Message.MessageViewModel"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Microsoft.AspNetCore.Mvc.ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": { }
      },
      "PatientScheduler.Api.Features.Appointment.Cancellation.AppointmentCancellationRequestModel": {
        "required": [
          "confirmationNumber",
          "email",
          "phoneCountryCode",
          "phoneNumber"
        ],
        "type": "object",
        "properties": {
          "confirmationNumber": {
            "type": "integer",
            "format": "int32"
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phoneCountryCode": {
            "type": "string",
            "nullable": true
          },
          "phoneNumber": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Appointment.Verification.AppointmentVerificationRequestModel": {
        "required": [
          "confirmationNumber",
          "email",
          "phoneCountryCode",
          "phoneNumber"
        ],
        "type": "object",
        "properties": {
          "confirmationNumber": {
            "type": "integer",
            "format": "int32"
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phoneCountryCode": {
            "type": "string",
            "nullable": true
          },
          "phoneNumber": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Appointment.Verification.AppointmentViewModel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "confirmationNumber": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "date": {
            "type": "string",
            "format": "date",
            "readOnly": true
          },
          "startTime": {
            "type": "string",
            "format": "time",
            "readOnly": true
          },
          "endTime": {
            "type": "string",
            "format": "time",
            "readOnly": true
          },
          "location": {
            "$ref": "#/components/schemas/PatientScheduler.Api.Features.Appointment.Verification.LocationViewModel"
          },
          "patient": {
            "$ref": "#/components/schemas/PatientScheduler.Api.Features.Appointment.Verification.PatientViewModel"
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Appointment.Verification.LocationViewModel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "code": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "address1": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "address2": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "city": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "state": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "country": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "zip": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Appointment.Verification.PatientViewModel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "firstName": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "middleName": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "lastName": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "email": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "phoneCountryCode": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "phoneNumber": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.AppointmentScheduling.AppointmentConfirmationViewModel": {
        "type": "object",
        "properties": {
          "confirmationNumber": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.AppointmentScheduling.AppointmentScheduleRequestModel": {
        "required": [
          "date",
          "locationId",
          "patient",
          "startTime"
        ],
        "type": "object",
        "properties": {
          "locationId": {
            "type": "integer",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "startTime": {
            "type": "string",
            "format": "time"
          },
          "patient": {
            "$ref": "#/components/schemas/PatientScheduler.Api.Features.AppointmentScheduling.PatientCreateRequestModel"
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.AppointmentScheduling.PatientCreateRequestModel": {
        "required": [
          "birthDate",
          "city",
          "country",
          "email",
          "firstName",
          "lastName",
          "middleName",
          "phoneCountryCode",
          "phoneNumber",
          "sexAtBirth",
          "state",
          "street1",
          "street2",
          "zipCode"
        ],
        "type": "object",
        "properties": {
          "firstName": {
            "type": "string",
            "nullable": true
          },
          "middleName": {
            "type": "string",
            "nullable": true
          },
          "lastName": {
            "type": "string",
            "nullable": true
          },
          "birthDate": {
            "type": "string",
            "format": "date"
          },
          "sexAtBirth": {
            "$ref": "#/components/schemas/PatientScheduler.Domain.DomainModel.Enums.SexAtBirth"
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phoneCountryCode": {
            "type": "string",
            "nullable": true
          },
          "phoneNumber": {
            "type": "string",
            "nullable": true
          },
          "street1": {
            "type": "string",
            "nullable": true
          },
          "street2": {
            "type": "string",
            "nullable": true
          },
          "city": {
            "type": "string",
            "nullable": true
          },
          "state": {
            "type": "string",
            "nullable": true
          },
          "zipCode": {
            "type": "string",
            "nullable": true
          },
          "country": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Message.MessageViewModel": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/PatientScheduler.Domain.DomainModel.Enums.MessageType"
          },
          "text": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Schedule.AppointmentCountViewModel": {
        "type": "object",
        "properties": {
          "weekDay": {
            "$ref": "#/components/schemas/System.DayOfWeek"
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Schedule.AvailableAppointmentsViewModel": {
        "type": "object",
        "properties": {
          "appointments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.LocationAppointmentsCountViewModel"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Schedule.LocationAppointmentsCountViewModel": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "slots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.AppointmentCountViewModel"
            },
            "nullable": true,
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Schedule.LocationItemViewModel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "code": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "name": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "street1": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "street2": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "city": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "state": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "zip": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "country": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          },
          "latitude": {
            "type": "number",
            "format": "double",
            "readOnly": true
          },
          "longitude": {
            "type": "number",
            "format": "double",
            "readOnly": true
          },
          "timeZone": {
            "type": "string",
            "nullable": true,
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Schedule.LocationViewModel": {
        "type": "object",
        "properties": {
          "locations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.LocationItemViewModel"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Schedule.State.DateScheduleViewModel": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "readOnly": true
          },
          "slots": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.State.ScheduleSlotStateViewModel"
            },
            "nullable": true,
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Schedule.State.ScheduleSlotStateViewModel": {
        "type": "object",
        "properties": {
          "isAvailable": {
            "type": "boolean",
            "readOnly": true
          },
          "endTime": {
            "type": "string",
            "format": "time",
            "readOnly": true
          },
          "startTime": {
            "type": "string",
            "format": "time",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Api.Features.Schedule.State.ScheduleViewModel": {
        "type": "object",
        "properties": {
          "schedule": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PatientScheduler.Api.Features.Schedule.State.DateScheduleViewModel"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PatientScheduler.Domain.DomainModel.Enums.MessageType": {
        "enum": [
          1
        ],
        "type": "integer",
        "format": "int32"
      },
      "PatientScheduler.Domain.DomainModel.Enums.SexAtBirth": {
        "enum": [
          1,
          2
        ],
        "type": "integer",
        "format": "int32"
      },
      "System.DayOfWeek": {
        "enum": [
          0,
          1,
          2,
          3,
          4,
          5,
          6
        ],
        "type": "integer",
        "format": "int32"
      }
    }
  },
  "tags": [
    {
      "name": "Appointment"
    },
    {
      "name": "Location"
    },
    {
      "name": "Message"
    }
  ]
}