/**
 * OCSF (Open Cybersecurity Schema Framework) v1.3 types for audit events.
 * See https://schema.ocsf.io/ for the full spec.
 *
 * We implement a subset relevant to Superblocks audit logging:
 * - Category 3: Identity & Access Management
 * - Category 6: Application Activity
 */
export var OCSFCategoryUid;
(function (OCSFCategoryUid) {
    OCSFCategoryUid[OCSFCategoryUid["IAM"] = 3] = "IAM";
    OCSFCategoryUid[OCSFCategoryUid["APPLICATION_ACTIVITY"] = 6] = "APPLICATION_ACTIVITY";
})(OCSFCategoryUid || (OCSFCategoryUid = {}));
export var OCSFClassUid;
(function (OCSFClassUid) {
    OCSFClassUid[OCSFClassUid["ACCOUNT_CHANGE"] = 3001] = "ACCOUNT_CHANGE";
    OCSFClassUid[OCSFClassUid["AUTHENTICATION"] = 3002] = "AUTHENTICATION";
    OCSFClassUid[OCSFClassUid["ENTITY_MANAGEMENT"] = 3004] = "ENTITY_MANAGEMENT";
    OCSFClassUid[OCSFClassUid["USER_ACCESS_MANAGEMENT"] = 3005] = "USER_ACCESS_MANAGEMENT";
    OCSFClassUid[OCSFClassUid["APPLICATION_LIFECYCLE"] = 6002] = "APPLICATION_LIFECYCLE";
    OCSFClassUid[OCSFClassUid["API_ACTIVITY"] = 6003] = "API_ACTIVITY";
})(OCSFClassUid || (OCSFClassUid = {}));
export var OCSFActivityId;
(function (OCSFActivityId) {
    OCSFActivityId[OCSFActivityId["UNKNOWN"] = 0] = "UNKNOWN";
    OCSFActivityId[OCSFActivityId["CREATE"] = 1] = "CREATE";
    OCSFActivityId[OCSFActivityId["READ"] = 2] = "READ";
    OCSFActivityId[OCSFActivityId["UPDATE"] = 3] = "UPDATE";
    OCSFActivityId[OCSFActivityId["DELETE"] = 4] = "DELETE";
    OCSFActivityId[OCSFActivityId["EXECUTE"] = 5] = "EXECUTE";
    OCSFActivityId[OCSFActivityId["LOGIN"] = 6] = "LOGIN";
    OCSFActivityId[OCSFActivityId["LOGOUT"] = 7] = "LOGOUT";
    OCSFActivityId[OCSFActivityId["DEPLOY"] = 8] = "DEPLOY";
    OCSFActivityId[OCSFActivityId["GRANT"] = 9] = "GRANT";
    OCSFActivityId[OCSFActivityId["REVOKE"] = 10] = "REVOKE";
    OCSFActivityId[OCSFActivityId["OTHER"] = 99] = "OTHER";
})(OCSFActivityId || (OCSFActivityId = {}));
export var OCSFStatusId;
(function (OCSFStatusId) {
    OCSFStatusId[OCSFStatusId["UNKNOWN"] = 0] = "UNKNOWN";
    OCSFStatusId[OCSFStatusId["SUCCESS"] = 1] = "SUCCESS";
    OCSFStatusId[OCSFStatusId["FAILURE"] = 2] = "FAILURE";
    OCSFStatusId[OCSFStatusId["IN_PROGRESS"] = 99] = "IN_PROGRESS";
})(OCSFStatusId || (OCSFStatusId = {}));
export var OCSFSeverityId;
(function (OCSFSeverityId) {
    OCSFSeverityId[OCSFSeverityId["UNKNOWN"] = 0] = "UNKNOWN";
    OCSFSeverityId[OCSFSeverityId["INFORMATIONAL"] = 1] = "INFORMATIONAL";
    OCSFSeverityId[OCSFSeverityId["LOW"] = 2] = "LOW";
    OCSFSeverityId[OCSFSeverityId["MEDIUM"] = 3] = "MEDIUM";
    OCSFSeverityId[OCSFSeverityId["HIGH"] = 4] = "HIGH";
    OCSFSeverityId[OCSFSeverityId["CRITICAL"] = 5] = "CRITICAL";
    OCSFSeverityId[OCSFSeverityId["FATAL"] = 6] = "FATAL";
})(OCSFSeverityId || (OCSFSeverityId = {}));
export function computeTypeUid(classUid, activityId) {
    return classUid * 100 + activityId;
}
/**
 * Complete catalog of OCSF audit event types emitted by Superblocks.
 * Derived from `auditResource` (class/category/resource) and `AuditOp` (operations)
 * in `packages/server/src/middleware/auditEvent.ts`.
 */
export const AUDIT_EVENT_TYPE_CATALOG = [
    {
        class_uid: OCSFClassUid.API_ACTIVITY,
        class_name: 'API_ACTIVITY',
        category_uid: OCSFCategoryUid.APPLICATION_ACTIVITY,
        category_name: 'APPLICATION_ACTIVITY',
        resource_type: 'API',
        operations: ['api.bulk_delete', 'api.create', 'api.delete', 'api.deploy', 'api.metadata.update', 'api.settings.update']
    },
    {
        class_uid: OCSFClassUid.APPLICATION_LIFECYCLE,
        class_name: 'APPLICATION_LIFECYCLE',
        category_uid: OCSFCategoryUid.APPLICATION_ACTIVITY,
        category_name: 'APPLICATION_ACTIVITY',
        resource_type: 'Application',
        operations: [
            'application.clone',
            'application.create',
            'application.create_from_template',
            'application.delete',
            'application.deploy',
            'application.git.connect',
            'application.git.disconnect',
            'application.metadata.update',
            'application.settings.update',
            'application.undeploy'
        ]
    },
    {
        class_uid: OCSFClassUid.AUTHENTICATION,
        class_name: 'AUTHENTICATION',
        category_uid: OCSFCategoryUid.IAM,
        category_name: 'IAM',
        resource_type: 'Session',
        operations: ['email.verify', 'oauth.exchange_code', 'oauth.shared_token.revoke', 'oauth.user_token.revoke']
    },
    {
        class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
        class_name: 'ENTITY_MANAGEMENT',
        category_uid: OCSFCategoryUid.APPLICATION_ACTIVITY,
        category_name: 'APPLICATION_ACTIVITY',
        resource_type: 'Billing',
        operations: ['billing.downgrade', 'billing.seat.assign', 'billing.seat.unassign', 'billing.subscription.update']
    },
    {
        class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
        class_name: 'ENTITY_MANAGEMENT',
        category_uid: OCSFCategoryUid.IAM,
        category_name: 'IAM',
        resource_type: 'Credential',
        operations: ['credential.delete', 'credential.upsert']
    },
    {
        class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
        class_name: 'ENTITY_MANAGEMENT',
        category_uid: OCSFCategoryUid.APPLICATION_ACTIVITY,
        category_name: 'APPLICATION_ACTIVITY',
        resource_type: 'File',
        operations: ['file.delete', 'file.upload']
    },
    {
        class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
        class_name: 'ENTITY_MANAGEMENT',
        category_uid: OCSFCategoryUid.APPLICATION_ACTIVITY,
        category_name: 'APPLICATION_ACTIVITY',
        resource_type: 'Folder',
        operations: ['folder.create', 'folder.delete', 'folder.update']
    },
    {
        class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
        class_name: 'ENTITY_MANAGEMENT',
        category_uid: OCSFCategoryUid.APPLICATION_ACTIVITY,
        category_name: 'APPLICATION_ACTIVITY',
        resource_type: 'Integration',
        operations: [
            'integration.create',
            'integration.delete',
            'integration.ownership.update',
            'integration.secret.view',
            'integration.update'
        ]
    },
    {
        class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
        class_name: 'ENTITY_MANAGEMENT',
        category_uid: OCSFCategoryUid.APPLICATION_ACTIVITY,
        category_name: 'APPLICATION_ACTIVITY',
        resource_type: 'Knowledge',
        operations: ['knowledge.create', 'knowledge.delete', 'knowledge.update']
    },
    {
        class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
        class_name: 'ENTITY_MANAGEMENT',
        category_uid: OCSFCategoryUid.APPLICATION_ACTIVITY,
        category_name: 'APPLICATION_ACTIVITY',
        resource_type: 'Organization',
        operations: ['organization.settings.update', 'organization.update']
    },
    {
        class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
        class_name: 'ENTITY_MANAGEMENT',
        category_uid: OCSFCategoryUid.APPLICATION_ACTIVITY,
        category_name: 'APPLICATION_ACTIVITY',
        resource_type: 'Profile',
        operations: ['profile.create', 'profile.delete', 'profile.manage', 'profile.update']
    },
    {
        class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
        class_name: 'ENTITY_MANAGEMENT',
        category_uid: OCSFCategoryUid.APPLICATION_ACTIVITY,
        category_name: 'APPLICATION_ACTIVITY',
        resource_type: 'Repository',
        operations: [
            'repository.branch.delete',
            'repository.branch_protection.update',
            'repository.create',
            'repository.delete',
            'repository.update'
        ]
    },
    {
        class_uid: OCSFClassUid.ENTITY_MANAGEMENT,
        class_name: 'ENTITY_MANAGEMENT',
        category_uid: OCSFCategoryUid.IAM,
        category_name: 'IAM',
        resource_type: 'Token',
        operations: ['token.create', 'token.delete', 'token.regenerate', 'token.update']
    },
    {
        class_uid: OCSFClassUid.USER_ACCESS_MANAGEMENT,
        class_name: 'USER_ACCESS_MANAGEMENT',
        category_uid: OCSFCategoryUid.IAM,
        category_name: 'IAM',
        resource_type: 'Group',
        operations: [
            'group.create',
            'group.delete',
            'group.members.update',
            'group.role.delete',
            'group.role.update',
            'group.update',
            'scim.group.create',
            'scim.group.delete',
            'scim.group.update'
        ]
    },
    {
        class_uid: OCSFClassUid.USER_ACCESS_MANAGEMENT,
        class_name: 'USER_ACCESS_MANAGEMENT',
        category_uid: OCSFCategoryUid.IAM,
        category_name: 'IAM',
        resource_type: 'Permission',
        operations: ['permission.create', 'permission.delete', 'permission.update']
    },
    {
        class_uid: OCSFClassUid.USER_ACCESS_MANAGEMENT,
        class_name: 'USER_ACCESS_MANAGEMENT',
        category_uid: OCSFCategoryUid.IAM,
        category_name: 'IAM',
        resource_type: 'Role',
        operations: ['role.create', 'role.delete', 'role.settings.update', 'role.update']
    },
    {
        class_uid: OCSFClassUid.USER_ACCESS_MANAGEMENT,
        class_name: 'USER_ACCESS_MANAGEMENT',
        category_uid: OCSFCategoryUid.IAM,
        category_name: 'IAM',
        resource_type: 'User',
        operations: [
            'scim.user.create',
            'scim.user.delete',
            'scim.user.update',
            'user.activate',
            'user.add',
            'user.invite',
            'user.role.update',
            'user.roles.bulk_update'
        ]
    }
];
// ---------------------------------------------------------------------------
// OCSF metadata helpers
// ---------------------------------------------------------------------------
const METADATA = {
    product: { name: 'Superblocks', vendor_name: 'Superblocks' },
    version: '1.3.0'
};
export function buildOCSFMetadata(logName) {
    return { ...METADATA, log_name: logName };
}
//# sourceMappingURL=ocsf.js.map