{
  "openapi": "3.0.1",
  "info": {
    "title": "DYR Tech Subscriptions API",
    "description": "Precios custom por cliente: PrecioMadre × CantMadre + PrecioBranch × CantBranch",
    "version": "v1"
  },
  "paths": {
    "/api/auth/admin/login": {
      "post": {
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/LoginReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LoginReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/LoginRes"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginRes"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginRes"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/client/login": {
      "post": {
        "tags": [
          "Auth"
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/LoginReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/LoginReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/LoginRes"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginRes"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginRes"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/check-access": {
      "get": {
        "tags": [
          "Auth"
        ],
        "parameters": [
          {
            "name": "email",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/CheckAccessRes"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckAccessRes"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckAccessRes"
                }
              }
            }
          }
        }
      }
    },
    "/api/payments/card/charge": {
      "post": {
        "tags": [
          "CardPayment"
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CardChargeReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardChargeReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CardChargeReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CardChargeReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/clients": {
      "get": {
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ClientListDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ClientListDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ClientListDto"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Clients"
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateClientReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateClientReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateClientReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateClientReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/clients/{id}": {
      "get": {
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ClientDetailDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientDetailDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientDetailDto"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateClientReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateClientReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateClientReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateClientReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/clients/{id}/toggle-active": {
      "patch": {
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/clients/{id}/subscription/price": {
      "put": {
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePriceReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePriceReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePriceReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePriceReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/clients/{id}/subscription/suspend": {
      "patch": {
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/clients/{id}/subscription/reactivate": {
      "patch": {
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/clients/{id}/branches": {
      "post": {
        "tags": [
          "Clients"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBranchReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBranchReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBranchReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBranchReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/dashboard": {
      "get": {
        "tags": [
          "Dashboard"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/DashboardDto"
                }
              }
            }
          }
        }
      }
    },
    "/": {
      "get": {
        "tags": [
          "DyrTech.Subs"
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/payment/success": {
      "get": {
        "tags": [
          "DyrTech.Subs"
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/payment/cancel": {
      "get": {
        "tags": [
          "DyrTech.Subs"
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/test-hash": {
      "get": {
        "tags": [
          "DyrTech.Subs"
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/config/payment-methods": {
      "get": {
        "tags": [
          "DyrTech.Subs"
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/payments/paypal/create-order": {
      "post": {
        "tags": [
          "Payments"
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/CreateOrderRes"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateOrderRes"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateOrderRes"
                }
              }
            }
          }
        }
      }
    },
    "/api/payments/paypal/capture": {
      "post": {
        "tags": [
          "Payments"
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CaptureReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaptureReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CaptureReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CaptureReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/payments/manual": {
      "post": {
        "tags": [
          "Payments"
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ManualPaymentReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManualPaymentReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ManualPaymentReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ManualPaymentReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/payments": {
      "get": {
        "tags": [
          "Payments"
        ],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/payments/client/{clientId}": {
      "get": {
        "tags": [
          "Payments"
        ],
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/plans": {
      "get": {
        "tags": [
          "Plans"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PlanDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PlanDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PlanDto"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Plans"
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlanReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlanReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlanReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlanReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/plans/{id}": {
      "put": {
        "tags": [
          "Plans"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlanReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlanReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlanReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePlanReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/portal/me": {
      "get": {
        "tags": [
          "Portal"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/PortalDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/portal/profile": {
      "put": {
        "tags": [
          "Portal"
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateClientReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateClientReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateClientReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateClientReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/portal/change-password": {
      "post": {
        "tags": [
          "Portal"
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePassReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePassReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePassReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ChangePassReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/settings": {
      "get": {
        "tags": [
          "Settings"
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SettingDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SettingDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SettingDto"
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Settings"
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSettingsReq"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSettingsReq"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSettingsReq"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSettingsReq"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/webhook/paypal": {
      "post": {
        "tags": [
          "Webhook"
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "BranchDto": {
        "type": "object",
        "properties": {
          "branchId": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "isMother": {
            "type": "boolean"
          },
          "isActive": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "CaptureReq": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "nullable": true
          },
          "subscriptionId": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "CardChargeReq": {
        "type": "object",
        "properties": {
          "subscriptionId": {
            "type": "integer",
            "format": "int32"
          },
          "processor": {
            "type": "string",
            "nullable": true
          },
          "cardNumber": {
            "type": "string",
            "nullable": true
          },
          "expiry": {
            "type": "string",
            "nullable": true
          },
          "cvv": {
            "type": "string",
            "nullable": true
          },
          "cardHolder": {
            "type": "string",
            "nullable": true
          },
          "currency": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ChangePassReq": {
        "type": "object",
        "properties": {
          "currentPassword": {
            "type": "string",
            "nullable": true
          },
          "newPassword": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CheckAccessRes": {
        "type": "object",
        "properties": {
          "hasAccess": {
            "type": "boolean"
          },
          "showGraceWarning": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "daysUntilExpiry": {
            "type": "integer",
            "format": "int32"
          },
          "planName": {
            "type": "string",
            "nullable": true
          },
          "message": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ClientDetailDto": {
        "type": "object",
        "properties": {
          "clientId": {
            "type": "integer",
            "format": "int32"
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "taxId": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "branches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BranchDto"
            },
            "nullable": true
          },
          "activeSubscription": {
            "$ref": "#/components/schemas/SubDetailDto"
          },
          "recentPayments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ClientListDto": {
        "type": "object",
        "properties": {
          "clientId": {
            "type": "integer",
            "format": "int32"
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "activeSubscription": {
            "$ref": "#/components/schemas/SubSummaryDto"
          },
          "branchCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "CreateBranchReq": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "isMother": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "CreateClientReq": {
        "type": "object",
        "properties": {
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "password": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "taxId": {
            "type": "string",
            "nullable": true
          },
          "address": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "planId": {
            "type": "integer",
            "format": "int32"
          },
          "priceMotherUnit": {
            "type": "number",
            "format": "double"
          },
          "pricePerBranch": {
            "type": "number",
            "format": "double"
          },
          "motherUnitCount": {
            "type": "integer",
            "format": "int32"
          },
          "branchCount": {
            "type": "integer",
            "format": "int32"
          },
          "discount": {
            "type": "number",
            "format": "double"
          },
          "discountReason": {
            "type": "string",
            "nullable": true
          },
          "contractNotes": {
            "type": "string",
            "nullable": true
          },
          "branches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateBranchReq"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreateOrderReq": {
        "type": "object",
        "properties": {
          "subscriptionId": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "CreateOrderRes": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "nullable": true
          },
          "approvalUrl": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreatePlanReq": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "features": {
            "type": "string",
            "nullable": true
          },
          "colorHex": {
            "type": "string",
            "nullable": true
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "DashboardDto": {
        "type": "object",
        "properties": {
          "activeCount": {
            "type": "integer",
            "format": "int32"
          },
          "graceCount": {
            "type": "integer",
            "format": "int32"
          },
          "suspendedCount": {
            "type": "integer",
            "format": "int32"
          },
          "cancelledCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "mrr": {
            "type": "number",
            "format": "double"
          },
          "revenueThisMonth": {
            "type": "number",
            "format": "double"
          },
          "revenueLastMonth": {
            "type": "number",
            "format": "double"
          },
          "revenueTotal": {
            "type": "number",
            "format": "double"
          }
        },
        "additionalProperties": false
      },
      "LoginReq": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "nullable": true
          },
          "password": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "LoginRes": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "nullable": true
          },
          "role": {
            "type": "string",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "id": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "ManualPaymentReq": {
        "type": "object",
        "properties": {
          "subscriptionId": {
            "type": "integer",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "paymentMethod": {
            "type": "string",
            "nullable": true
          },
          "transactionRef": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PaymentDto": {
        "type": "object",
        "properties": {
          "paymentId": {
            "type": "integer",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "paymentMethod": {
            "type": "string",
            "nullable": true
          },
          "payPalCaptureId": {
            "type": "string",
            "nullable": true
          },
          "periodStart": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "periodEnd": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "paymentDate": {
            "type": "string",
            "format": "date-time"
          },
          "registeredByAdmin": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PlanDto": {
        "type": "object",
        "properties": {
          "planId": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "features": {
            "type": "string",
            "nullable": true
          },
          "colorHex": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "PortalDto": {
        "type": "object",
        "properties": {
          "clientId": {
            "type": "integer",
            "format": "int32"
          },
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "subscription": {
            "$ref": "#/components/schemas/SubDetailDto"
          },
          "paymentHistory": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentDto"
            },
            "nullable": true
          },
          "branches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BranchDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SettingDto": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "nullable": true
          },
          "value": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SubDetailDto": {
        "type": "object",
        "properties": {
          "subscriptionId": {
            "type": "integer",
            "format": "int32"
          },
          "planId": {
            "type": "integer",
            "format": "int32"
          },
          "planName": {
            "type": "string",
            "nullable": true
          },
          "planColor": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "priceMotherUnit": {
            "type": "number",
            "format": "double"
          },
          "pricePerBranch": {
            "type": "number",
            "format": "double"
          },
          "motherUnitCount": {
            "type": "integer",
            "format": "int32"
          },
          "branchCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalMonthlyPrice": {
            "type": "number",
            "format": "double"
          },
          "discount": {
            "type": "number",
            "format": "double"
          },
          "discountReason": {
            "type": "string",
            "nullable": true
          },
          "finalPrice": {
            "type": "number",
            "format": "double"
          },
          "currency": {
            "type": "string",
            "nullable": true
          },
          "startDate": {
            "type": "string",
            "format": "date"
          },
          "currentPeriodStart": {
            "type": "string",
            "format": "date"
          },
          "currentPeriodEnd": {
            "type": "string",
            "format": "date"
          },
          "gracePeriodDays": {
            "type": "integer",
            "format": "int32"
          },
          "daysUntilExpiry": {
            "type": "integer",
            "format": "int32"
          },
          "autoRenew": {
            "type": "boolean"
          },
          "lastPaymentDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "contractNotes": {
            "type": "string",
            "nullable": true
          },
          "failedPaymentCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "SubSummaryDto": {
        "type": "object",
        "properties": {
          "subscriptionId": {
            "type": "integer",
            "format": "int32"
          },
          "planName": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string",
            "nullable": true
          },
          "totalMonthlyPrice": {
            "type": "number",
            "format": "double"
          },
          "finalPrice": {
            "type": "number",
            "format": "double"
          },
          "currentPeriodEnd": {
            "type": "string",
            "format": "date"
          },
          "daysUntilExpiry": {
            "type": "integer",
            "format": "int32"
          },
          "motherUnitCount": {
            "type": "integer",
            "format": "int32"
          },
          "branchCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "UpdateClientReq": {
        "type": "object",
        "properties": {
          "companyName": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "contactName": {
            "type": "string",
            "nullable": true
          },
          "taxId": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdatePriceReq": {
        "type": "object",
        "properties": {
          "planId": {
            "type": "integer",
            "format": "int32"
          },
          "priceMotherUnit": {
            "type": "number",
            "format": "double"
          },
          "pricePerBranch": {
            "type": "number",
            "format": "double"
          },
          "motherUnitCount": {
            "type": "integer",
            "format": "int32"
          },
          "branchCount": {
            "type": "integer",
            "format": "int32"
          },
          "discount": {
            "type": "number",
            "format": "double"
          },
          "discountReason": {
            "type": "string",
            "nullable": true
          },
          "contractNotes": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateSettingsReq": {
        "type": "object",
        "properties": {
          "settings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SettingDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "apiKey",
        "description": "Bearer {token}",
        "name": "Authorization",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "Bearer": [ ]
    }
  ]
}