{
  "openapi": "3.0.0",
  "info": {
    "title": "api-certification",
    "version": "0.0.1",
    "description": "API Certification Backend using LoopBack 4",
    "contact": {
      "name": "iameidos",
      "email": "faizaldou@gmail.com"
    }
  },
  "paths": {
    "/activity-logs": {
      "post": {
        "x-controller-name": "ActivityLogController",
        "x-operation-name": "create",
        "tags": [
          "ActivityLogController"
        ],
        "responses": {
          "200": {
            "description": "Create activity log instance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "operationId": "ActivityLogController.create"
      },
      "get": {
        "x-controller-name": "ActivityLogController",
        "x-operation-name": "find",
        "tags": [
          "ActivityLogController"
        ],
        "responses": {
          "200": {
            "description": "Array of ActivityLog model instances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "operationId": "ActivityLogController.find"
      },
      "delete": {
        "x-controller-name": "ActivityLogController",
        "x-operation-name": "delete",
        "tags": [
          "ActivityLogController"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "description": "ActivityLog DELETE success"
                }
              }
            }
          }
        },
        "operationId": "ActivityLogController.delete"
      }
    },
    "/auth/login": {
      "post": {
        "x-controller-name": "AuthController",
        "x-operation-name": "login",
        "tags": [
          "AuthController"
        ],
        "responses": {
          "200": {
            "description": "Login successful, returns JWT Token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "token": {
                      "type": "string"
                    },
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "username": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "username",
                  "password"
                ],
                "properties": {
                  "username": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "operationId": "AuthController.login"
      }
    },
    "/auth/me": {
      "get": {
        "x-controller-name": "AuthController",
        "x-operation-name": "me",
        "tags": [
          "AuthController"
        ],
        "responses": {
          "200": {
            "description": "Get details of the current logged-in user",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "username": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "AuthController.me"
      }
    },
    "/branches/{id}": {
      "patch": {
        "x-controller-name": "BranchController",
        "x-operation-name": "updateById",
        "tags": [
          "BranchController"
        ],
        "responses": {
          "200": {
            "description": "Cabang berhasil diperbarui",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          },
          "x-parameter-index": 1
        },
        "operationId": "BranchController.updateById"
      },
      "get": {
        "x-controller-name": "BranchController",
        "x-operation-name": "findById",
        "tags": [
          "BranchController"
        ],
        "responses": {
          "200": {
            "description": "Detail cabang",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "BranchController.findById"
      },
      "delete": {
        "x-controller-name": "BranchController",
        "x-operation-name": "deleteById",
        "tags": [
          "BranchController"
        ],
        "responses": {
          "200": {
            "description": "Cabang berhasil dihapus",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "BranchController.deleteById"
      }
    },
    "/branches": {
      "post": {
        "x-controller-name": "BranchController",
        "x-operation-name": "create",
        "tags": [
          "BranchController"
        ],
        "responses": {
          "201": {
            "description": "Cabang berhasil dibuat",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "operationId": "BranchController.create"
      },
      "get": {
        "x-controller-name": "BranchController",
        "x-operation-name": "find",
        "tags": [
          "BranchController"
        ],
        "responses": {
          "200": {
            "description": "Daftar semua cabang",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                }
              }
            }
          }
        },
        "operationId": "BranchController.find"
      }
    },
    "/certificates/verify/{id}": {
      "get": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "verify",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "Public verification of certificate by certificate number, security hash or ID",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "object",
                      "nullable": true
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "CertificateController.verify"
      }
    },
    "/certificates/{id}/complete-recertification": {
      "post": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "completeRecertification",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Complete ISO recertification cycle"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "newIssueDate"
                ],
                "properties": {
                  "newIssueDate": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "x-parameter-index": 1
        },
        "operationId": "CertificateController.completeRecertification"
      }
    },
    "/certificates/{id}/complete-surveillance/{survNumber}": {
      "post": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "completeSurveillance",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Confirm surveillance audit"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "survNumber",
            "in": "path",
            "schema": {
              "type": "number"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "actualDate"
                ],
                "properties": {
                  "actualDate": {
                    "type": "string"
                  },
                  "auditorName": {
                    "type": "string"
                  },
                  "findingsStatus": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "x-parameter-index": 2
        },
        "operationId": "CertificateController.completeSurveillance"
      }
    },
    "/certificates/{id}/send-reminder": {
      "post": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "sendManualReminder",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "Send manual surveillance reminder email",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "overrideEmail": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "x-parameter-index": 1
        },
        "operationId": "CertificateController.sendManualReminder"
      }
    },
    "/certificates/{id}/update-status": {
      "post": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "updateStatus",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Update certificate status manually"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "status"
                ],
                "properties": {
                  "status": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "x-parameter-index": 1
        },
        "operationId": "CertificateController.updateStatus"
      }
    },
    "/certificates/{id}": {
      "patch": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "updateById",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "Certificate PATCH success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          },
          "x-parameter-index": 1
        },
        "operationId": "CertificateController.updateById"
      },
      "get": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "findById",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "Certificate model instance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "CertificateController.findById"
      },
      "delete": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "deleteById",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "Certificate DELETE success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "CertificateController.deleteById"
      }
    },
    "/certificates": {
      "post": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "create",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "Certificate model instance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "companyId",
                  "isoStandardId",
                  "issueDate",
                  "scopeOfCertification",
                  "certificateNumber"
                ]
              }
            }
          }
        },
        "operationId": "CertificateController.create"
      },
      "get": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "find",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "Array of Certificate model instances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "operationId": "CertificateController.find"
      }
    },
    "/companies/{id}": {
      "patch": {
        "x-controller-name": "CompanyController",
        "x-operation-name": "updateById",
        "tags": [
          "CompanyController"
        ],
        "responses": {
          "200": {
            "description": "Company PATCH success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          },
          "x-parameter-index": 1
        },
        "operationId": "CompanyController.updateById"
      },
      "delete": {
        "x-controller-name": "CompanyController",
        "x-operation-name": "deleteById",
        "tags": [
          "CompanyController"
        ],
        "responses": {
          "200": {
            "description": "Company DELETE success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "CompanyController.deleteById"
      }
    },
    "/companies": {
      "post": {
        "x-controller-name": "CompanyController",
        "x-operation-name": "create",
        "tags": [
          "CompanyController"
        ],
        "responses": {
          "200": {
            "description": "Company model instance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "name",
                  "email",
                  "address"
                ]
              }
            }
          }
        },
        "operationId": "CompanyController.create"
      },
      "get": {
        "x-controller-name": "CompanyController",
        "x-operation-name": "find",
        "tags": [
          "CompanyController"
        ],
        "responses": {
          "200": {
            "description": "Array of Company model instances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "operationId": "CompanyController.find"
      }
    },
    "/cron/surveillance-reminders": {
      "get": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "triggerCron",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Trigger cron surveillance reminders"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "required": false
          }
        ],
        "operationId": "CertificateController.triggerCron"
      }
    },
    "/departments/{id}": {
      "patch": {
        "x-controller-name": "DepartmentController",
        "x-operation-name": "updateById",
        "tags": [
          "DepartmentController"
        ],
        "responses": {
          "200": {
            "description": "Department PATCH success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "headName": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "x-parameter-index": 1
        },
        "operationId": "DepartmentController.updateById"
      },
      "delete": {
        "x-controller-name": "DepartmentController",
        "x-operation-name": "deleteById",
        "tags": [
          "DepartmentController"
        ],
        "responses": {
          "204": {
            "description": "No Content",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Department DELETE success"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "DepartmentController.deleteById"
      }
    },
    "/departments": {
      "post": {
        "x-controller-name": "DepartmentController",
        "x-operation-name": "create",
        "tags": [
          "DepartmentController"
        ],
        "responses": {
          "200": {
            "description": "Department model instance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "code"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "headName": {
                    "type": "string"
                  },
                  "branchId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "operationId": "DepartmentController.create"
      },
      "get": {
        "x-controller-name": "DepartmentController",
        "x-operation-name": "find",
        "tags": [
          "DepartmentController"
        ],
        "responses": {
          "200": {
            "description": "Array of Department model instances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "operationId": "DepartmentController.find"
      }
    },
    "/email-logs/send-custom": {
      "post": {
        "x-controller-name": "EmailLogController",
        "x-operation-name": "sendCustomEmail",
        "tags": [
          "EmailLogController"
        ],
        "responses": {
          "200": {
            "description": "Send custom email to client",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "toEmail",
                  "clientName",
                  "subject",
                  "message"
                ],
                "properties": {
                  "toEmail": {
                    "type": "string"
                  },
                  "clientName": {
                    "type": "string"
                  },
                  "subject": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  },
                  "certId": {
                    "type": "string"
                  },
                  "senderName": {
                    "type": "string"
                  },
                  "branchName": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "operationId": "EmailLogController.sendCustomEmail"
      }
    },
    "/email-logs/{id}": {
      "get": {
        "x-controller-name": "EmailLogController",
        "x-operation-name": "findById",
        "tags": [
          "EmailLogController"
        ],
        "responses": {
          "200": {
            "description": "EmailLog model instance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "EmailLogController.findById"
      },
      "delete": {
        "x-controller-name": "EmailLogController",
        "x-operation-name": "deleteById",
        "tags": [
          "EmailLogController"
        ],
        "responses": {
          "200": {
            "description": "Delete an email log",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "EmailLogController.deleteById"
      }
    },
    "/email-logs": {
      "get": {
        "x-controller-name": "EmailLogController",
        "x-operation-name": "find",
        "tags": [
          "EmailLogController"
        ],
        "responses": {
          "200": {
            "description": "Array of EmailLog model instances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "operationId": "EmailLogController.find"
      }
    },
    "/email-templates/{id}": {
      "patch": {
        "x-controller-name": "EmailTemplateController",
        "x-operation-name": "updateById",
        "tags": [
          "EmailTemplateController"
        ],
        "responses": {
          "200": {
            "description": "Update an email template",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "category": {
                    "type": "string"
                  },
                  "subject": {
                    "type": "string"
                  },
                  "bodyText": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "x-parameter-index": 1
        },
        "operationId": "EmailTemplateController.updateById"
      },
      "get": {
        "x-controller-name": "EmailTemplateController",
        "x-operation-name": "findById",
        "tags": [
          "EmailTemplateController"
        ],
        "responses": {
          "200": {
            "description": "EmailTemplate model instance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "EmailTemplateController.findById"
      },
      "delete": {
        "x-controller-name": "EmailTemplateController",
        "x-operation-name": "deleteById",
        "tags": [
          "EmailTemplateController"
        ],
        "responses": {
          "200": {
            "description": "Delete an email template",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "EmailTemplateController.deleteById"
      }
    },
    "/email-templates": {
      "post": {
        "x-controller-name": "EmailTemplateController",
        "x-operation-name": "create",
        "tags": [
          "EmailTemplateController"
        ],
        "responses": {
          "200": {
            "description": "Create a new email template",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "category",
                  "subject",
                  "bodyText"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "category": {
                    "type": "string",
                    "enum": [
                      "AUDIT",
                      "DOCUMENT",
                      "CERTIFICATE",
                      "ANNOUNCEMENT",
                      "GENERAL"
                    ]
                  },
                  "subject": {
                    "type": "string"
                  },
                  "bodyText": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "operationId": "EmailTemplateController.create"
      },
      "get": {
        "x-controller-name": "EmailTemplateController",
        "x-operation-name": "find",
        "tags": [
          "EmailTemplateController"
        ],
        "responses": {
          "200": {
            "description": "Array of EmailTemplate model instances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "operationId": "EmailTemplateController.find"
      }
    },
    "/iso-standards/{id}": {
      "patch": {
        "x-controller-name": "ISOStandardController",
        "x-operation-name": "updateById",
        "tags": [
          "ISOStandardController"
        ],
        "responses": {
          "200": {
            "description": "ISOStandard PATCH success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          },
          "x-parameter-index": 1
        },
        "operationId": "ISOStandardController.updateById"
      },
      "delete": {
        "x-controller-name": "ISOStandardController",
        "x-operation-name": "deleteById",
        "tags": [
          "ISOStandardController"
        ],
        "responses": {
          "200": {
            "description": "ISOStandard DELETE success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "ISOStandardController.deleteById"
      }
    },
    "/iso-standards": {
      "post": {
        "x-controller-name": "ISOStandardController",
        "x-operation-name": "create",
        "tags": [
          "ISOStandardController"
        ],
        "responses": {
          "200": {
            "description": "ISOStandard model instance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "id",
                  "code",
                  "title",
                  "description"
                ]
              }
            }
          }
        },
        "operationId": "ISOStandardController.create"
      },
      "get": {
        "x-controller-name": "ISOStandardController",
        "x-operation-name": "find",
        "tags": [
          "ISOStandardController"
        ],
        "responses": {
          "200": {
            "description": "Array of ISOStandard model instances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "operationId": "ISOStandardController.find"
      }
    },
    "/notifications/read-all": {
      "post": {
        "x-controller-name": "NotificationController",
        "x-operation-name": "markAllRead",
        "tags": [
          "NotificationController"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Mark all notifications as read"
                }
              }
            }
          }
        },
        "operationId": "NotificationController.markAllRead"
      }
    },
    "/notifications/{id}/read": {
      "post": {
        "x-controller-name": "NotificationController",
        "x-operation-name": "markRead",
        "tags": [
          "NotificationController"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Mark notification as read"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "NotificationController.markRead"
      }
    },
    "/notifications/{id}": {
      "delete": {
        "x-controller-name": "NotificationController",
        "x-operation-name": "deleteById",
        "tags": [
          "NotificationController"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Delete a single notification"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "NotificationController.deleteById"
      }
    },
    "/notifications": {
      "post": {
        "x-controller-name": "NotificationController",
        "x-operation-name": "create",
        "tags": [
          "NotificationController"
        ],
        "responses": {
          "200": {
            "description": "Create a new notification",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "operationId": "NotificationController.create"
      },
      "get": {
        "x-controller-name": "NotificationController",
        "x-operation-name": "find",
        "tags": [
          "NotificationController"
        ],
        "responses": {
          "200": {
            "description": "Array of Notification model instances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "operationId": "NotificationController.find"
      },
      "delete": {
        "x-controller-name": "NotificationController",
        "x-operation-name": "clearAll",
        "tags": [
          "NotificationController"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "description": "Clear all notifications"
                }
              }
            }
          }
        },
        "operationId": "NotificationController.clearAll"
      }
    },
    "/ping": {
      "get": {
        "x-controller-name": "PingController",
        "x-operation-name": "ping",
        "tags": [
          "PingController"
        ],
        "responses": {
          "200": {
            "description": "Ping Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PingResponse"
                }
              }
            }
          }
        },
        "operationId": "PingController.ping"
      }
    },
    "/public/branches/{id}": {
      "get": {
        "x-controller-name": "PublicBranchController",
        "x-operation-name": "findPublicBranchById",
        "tags": [
          "PublicBranchController"
        ],
        "responses": {
          "200": {
            "description": "Detail cabang untuk portal publik",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "PublicBranchController.findPublicBranchById"
      }
    },
    "/public/branches": {
      "get": {
        "x-controller-name": "PublicBranchController",
        "x-operation-name": "findPublicBranches",
        "tags": [
          "PublicBranchController"
        ],
        "responses": {
          "200": {
            "description": "Daftar cabang aktif untuk portal publik (tanpa autentikasi)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array"
                }
              }
            }
          }
        },
        "operationId": "PublicBranchController.findPublicBranches"
      }
    },
    "/public/certificates": {
      "get": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "getPublicCertificates",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "Get public list of active certificates per branch",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "total": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "operationId": "CertificateController.getPublicCertificates"
      }
    },
    "/public/stats": {
      "get": {
        "x-controller-name": "CertificateController",
        "x-operation-name": "getPublicStats",
        "tags": [
          "CertificateController"
        ],
        "responses": {
          "200": {
            "description": "Get public statistics",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "activeCertificatesCount": {
                      "type": "number"
                    },
                    "totalCertificatesCount": {
                      "type": "number"
                    },
                    "totalCompaniesCount": {
                      "type": "number"
                    },
                    "totalISOStandardsCount": {
                      "type": "number"
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "operationId": "CertificateController.getPublicStats"
      }
    },
    "/users/{id}": {
      "patch": {
        "x-controller-name": "UserController",
        "x-operation-name": "updateById",
        "tags": [
          "UserController"
        ],
        "responses": {
          "200": {
            "description": "User model instance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "username": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "role": {
                    "type": "string"
                  },
                  "departmentId": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "nip": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string"
                  },
                  "joinDate": {
                    "type": "string"
                  },
                  "photo": {
                    "type": "string"
                  },
                  "branchId": {
                    "type": "string"
                  },
                  "branchIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "x-parameter-index": 1
        },
        "operationId": "UserController.updateById"
      },
      "get": {
        "x-controller-name": "UserController",
        "x-operation-name": "findById",
        "tags": [
          "UserController"
        ],
        "responses": {
          "200": {
            "description": "Get user by ID (Self or Manager)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "UserController.findById"
      },
      "delete": {
        "x-controller-name": "UserController",
        "x-operation-name": "deleteById",
        "tags": [
          "UserController"
        ],
        "responses": {
          "200": {
            "description": "User DELETE success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "UserController.deleteById"
      }
    },
    "/users": {
      "post": {
        "x-controller-name": "UserController",
        "x-operation-name": "create",
        "tags": [
          "UserController"
        ],
        "responses": {
          "200": {
            "description": "User model instance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "username",
                  "password",
                  "name",
                  "role",
                  "email"
                ],
                "properties": {
                  "username": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "role": {
                    "type": "string"
                  },
                  "departmentId": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "nip": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string"
                  },
                  "joinDate": {
                    "type": "string"
                  },
                  "branchId": {
                    "type": "string"
                  },
                  "branchIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "UserController.create"
      },
      "get": {
        "x-controller-name": "UserController",
        "x-operation-name": "find",
        "tags": [
          "UserController"
        ],
        "responses": {
          "200": {
            "description": "Array of User model instances",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "branchId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "operationId": "UserController.find"
      }
    }
  },
  "servers": [
    {
      "url": "https://api.icsnetwork.cloud"
    }
  ],
  "components": {
    "schemas": {
      "Notification": {
        "title": "Notification",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "INFO",
              "WARNING",
              "ALERT",
              "SUCCESS"
            ]
          },
          "category": {
            "type": "string",
            "enum": [
              "SURVEILLANCE",
              "CERTIFICATE",
              "SYSTEM",
              "SECURITY"
            ]
          },
          "createdAt": {
            "type": "string"
          },
          "isRead": {
            "type": "boolean"
          },
          "link": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "message",
          "type",
          "category",
          "createdAt"
        ],
        "additionalProperties": false
      },
      "ActivityLog": {
        "title": "ActivityLog",
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "timestamp": {
            "type": "string"
          },
          "actorName": {
            "type": "string"
          },
          "actorUsername": {
            "type": "string"
          },
          "actorRole": {
            "type": "string",
            "enum": [
              "SUPERADMIN",
              "ADMIN",
              "AUDITOR",
              "MARKETING",
              "CONSULTANT",
              "OWNER",
              "MEMBER"
            ]
          },
          "eventType": {
            "type": "string"
          },
          "targetId": {
            "type": "string"
          },
          "targetLabel": {
            "type": "string"
          },
          "details": {
            "type": "string"
          },
          "ipAddress": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "timestamp",
          "actorName",
          "actorUsername",
          "actorRole",
          "eventType"
        ],
        "additionalProperties": false
      },
      "PingResponse": {
        "type": "object",
        "title": "PingResponse",
        "properties": {
          "greeting": {
            "type": "string"
          },
          "date": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "headers": {
            "type": "object",
            "properties": {
              "Content-Type": {
                "type": "string"
              }
            },
            "additionalProperties": true
          }
        }
      }
    }
  }
}