<?xml version="1.0" encoding="UTF-8"?>
<unload unload_date="2026-09-08 11:42:00">
  <sys_remote_update_set action="INSERT_OR_UPDATE">
    <sys_id>4859238546be9220c4dd16b7539c6aa1</sys_id>
    <name>Mondooticket v1.0.0</name>
    <state>loaded</state>
    <description>Mondoo ServiceNow security integration - creates, updates, and deletes ServiceNow incidents based on security findings from the Mondoo platform.</description>
    <application_name>Global</application_name>
    <application_scope>global</application_scope>
    <application_version>1.0.0</application_version>
    <origin_sys_id>1bb16cc3936932104c0b70aefaba10b6</origin_sys_id>
    <remote_sys_id>4859238546be9220c4dd16b7539c6aa1</remote_sys_id>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_remote_update_set>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>6aabf7727b5c730fa2f48c411d850109</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_app_1bb16cc3936932104c0b70aefaba10b6</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_app action="INSERT_OR_UPDATE">
    <sys_id>1bb16cc3936932104c0b70aefaba10b6</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_app_1bb16cc3936932104c0b70aefaba10b6</sys_update_name>
    <active>true</active>
    <can_edit_in_studio>true</can_edit_in_studio>
    <enforce_license>log</enforce_license>
    <guided_setup_guid/>
    <hide_on_ui>false</hide_on_ui>
    <installed_as_dependency>false</installed_as_dependency>
    <js_level>es_latest</js_level>
    <licensable>true</licensable>
    <license_category>none</license_category>
    <license_model>none</license_model>
    <logo/>
    <menu/>
    <name>Mondooticket</name>
    <package_json>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/package.json</package_json>
    <package_resolver_version>1.0.0</package_resolver_version>
    <private>false</private>
    <restrict_table_access>false</restrict_table_access>
    <runtime_access_tracking>permissive</runtime_access_tracking>
    <scope>x_1877227_mondooti</scope>
    <scoped_administration>false</scoped_administration>
    <short_description/>
    <source>x_1877227_mondooti</source>
    <subscription_entitlement/>
    <trackable>true</trackable>
    <uninstall_blocked>false</uninstall_blocked>
    <user_role/>
    <version>1.0.0</version>
  </sys_app>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_app</target_name>
    <type>Application</type>
    <update_domain>global</update_domain>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>44a8784ce3198dea670f1bc41ae1389f</sys_id>
    <action>DELETE</action>
    <application display_value="Global">global</application>
    <name>sys_properties_82cfc16c498243f9941671b58e1812da</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_properties action="DELETE">
    <sys_id>82cfc16c498243f9941671b58e1812da</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_properties_82cfc16c498243f9941671b58e1812da</sys_update_name>
  </sys_properties>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_properties</target_name>
    <type>System Property</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>432a6c2082a85657257308f3243179c7</sys_id>
    <action>DELETE</action>
    <application display_value="Global">global</application>
    <name>sys_properties_cc3069f1834b4b6a9d5814d53bc78140</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_properties action="DELETE">
    <sys_id>cc3069f1834b4b6a9d5814d53bc78140</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_properties_cc3069f1834b4b6a9d5814d53bc78140</sys_update_name>
  </sys_properties>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_properties</target_name>
    <type>System Property</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>97eda6b29f1952a4732a1ba3fdb3da5a</sys_id>
    <action>DELETE</action>
    <application display_value="Global">global</application>
    <name>sys_properties_f27fe80aee6e45b58131ccd9529cab49</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_properties action="DELETE">
    <sys_id>f27fe80aee6e45b58131ccd9529cab49</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_properties_f27fe80aee6e45b58131ccd9529cab49</sys_update_name>
  </sys_properties>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_properties</target_name>
    <type>System Property</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>9f1352ac42bfae20ae6edcf95b70e73b</sys_id>
    <action>DELETE</action>
    <application display_value="Global">global</application>
    <name>sys_script_dd2ca77c886446d9bbe517a94b261fa6</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_script action="DELETE">
    <sys_id>dd2ca77c886446d9bbe517a94b261fa6</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_script_dd2ca77c886446d9bbe517a94b261fa6</sys_update_name>
  </sys_script>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_script</target_name>
    <type>Business Rule</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>b23a7c100feb4cd8a014bdd51940cd95</sys_id>
    <action>DELETE</action>
    <application display_value="Global">global</application>
    <name>sys_ws_definition_16f2b876b30a4ea98978d8ba9ff274a2</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_ws_definition action="DELETE">
    <sys_id>16f2b876b30a4ea98978d8ba9ff274a2</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_ws_definition_16f2b876b30a4ea98978d8ba9ff274a2</sys_update_name>
  </sys_ws_definition>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_ws_definition</target_name>
    <type>Scripted REST API</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>52089305ee9d0e7ff217ef9894b76db9</sys_id>
    <action>DELETE</action>
    <application display_value="Global">global</application>
    <name>sys_ws_operation_16975eee58fd432da3beacf4f43ec897</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_ws_operation action="DELETE">
    <sys_id>16975eee58fd432da3beacf4f43ec897</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_ws_operation_16975eee58fd432da3beacf4f43ec897</sys_update_name>
  </sys_ws_operation>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_ws_operation</target_name>
    <type>Scripted REST Resource</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>532563389edce2f54c1551e439940372</sys_id>
    <action>DELETE</action>
    <application display_value="Global">global</application>
    <name>sys_ws_operation_25812e180231484aa5b87c0e548b0f56</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_ws_operation action="DELETE">
    <sys_id>25812e180231484aa5b87c0e548b0f56</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_ws_operation_25812e180231484aa5b87c0e548b0f56</sys_update_name>
  </sys_ws_operation>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_ws_operation</target_name>
    <type>Scripted REST Resource</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>9d077c4d6c8561ad6823a4febc9121bf</sys_id>
    <action>DELETE</action>
    <application display_value="Global">global</application>
    <name>sys_ws_operation_fcfe877600e04ba4addc65863ce60139</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_ws_operation action="DELETE">
    <sys_id>fcfe877600e04ba4addc65863ce60139</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_ws_operation_fcfe877600e04ba4addc65863ce60139</sys_update_name>
  </sys_ws_operation>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_ws_operation</target_name>
    <type>Scripted REST Resource</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>a1c3c6252801672101e14d50f4307f24</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_module_1c21a330911d435d880114a1a9e729c3</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_module action="INSERT_OR_UPDATE">
    <sys_id>1c21a330911d435d880114a1a9e729c3</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_module_1c21a330911d435d880114a1a9e729c3</sys_update_name>
    <content><![CDATA[import { gs } from '@servicenow/glide';
import { GlideRecord } from '@servicenow/glide';
import { GlideDateTime } from '@servicenow/glide';
import { GlideSysAttachment } from '@servicenow/glide';
import { RESTAPIRequest, RESTAPIResponse } from '@servicenow/glide/sn_ws_int';

/**
 * Parses case_content to extract overview data, remediation script, risk level, and affected assets count
 * @param {string} caseContent - The markdown-formatted case content
 * @returns {{affectedNotes: string, remediationScript: string, riskLevel: string, affectedAssetsCount: number}}
 */
function parseCaseContent(caseContent) {
    if (!caseContent) {
        return {
            affectedNotes: '',
            remediationScript: '',
            riskLevel: 'Unknown',
            affectedAssetsCount: 0
        };
    }

    let affectedNotes = '';
    let remediationScript = '';
    let riskLevel = 'Unknown';
    let affectedAssetsCount = 0;

    // Extract overview section (from # Overview to # Remediation)
    const overviewMatch = caseContent.match(/# Overview([\s\S]*?)(?=# Remediation|$)/);
    if (overviewMatch) {
        // Include the # Overview heading and trim whitespace
        affectedNotes = ('# Overview' + overviewMatch[1]).trim();
    }

    // Extract remediation script from code block
    // Look for ```shell or ```powershell or ```bash or just ``` followed by the script
    const scriptMatch = caseContent.match(/```(?:shell|powershell|bash)?\n([\s\S]*?)```/);
    if (scriptMatch) {
        remediationScript = scriptMatch[1].trim();
    }

    // Extract risk level from the overview section
    // Looking for patterns like "on 1 asset" or "on 5 assets" in the first paragraph
    const assetCountMatch = caseContent.match(/on (\d+) assets?/i);
    if (assetCountMatch) {
        affectedAssetsCount = parseInt(assetCountMatch[1], 10);
    }

    // Extract risk level from the Scoring section
    // Looking for |Risk|<value>| in the table
    const riskMatch = caseContent.match(/\|Risk\|([^|\n]+)\|/i);
    if (riskMatch) {
        riskLevel = riskMatch[1].trim();
    }

    // Extract risk value for more detailed risk level
    const riskValueMatch = caseContent.match(/\|Risk value\|(\d+)\s*\/\s*100\|/i);
    if (riskValueMatch) {
        const riskValue = riskValueMatch[1];
        riskLevel = `${riskLevel} (${riskValue}/100)`;
    }

    return {
        affectedNotes,
        remediationScript,
        riskLevel,
        affectedAssetsCount
    };
}

export function createCaseHandler(request, response) {
    try {
        // Set Content-Type header for JSON response
        response.setContentType('application/json');
        
        // Parse the request body
        const requestBody = request.body;
        const data = requestBody.data;
        
        if (!data) {
            response.setStatus(400);
            response.getStreamWriter().writeString(JSON.stringify({
                error: 'Missing data in request body',
                status: 'error'
            }));
            return;
        }

        const spaceId = data.space_id;
        const caseTitle = data.title;
        const caseContent = data.content;
        const urgency = data.urgency;
        const impact = data.impact;
        const priority = data.priority;

        // Validate required fields
        if (!spaceId || !caseTitle) {
            response.setStatus(400);
            response.getStreamWriter().writeString(JSON.stringify({
                error: 'Missing required fields: space_id and case_title are required',
                status: 'error'
            }));
            return;
        }

        // Parse the case content to extract overview, remediation script, risk level, and affected assets count
        const { affectedNotes, remediationScript, riskLevel, affectedAssetsCount } = parseCaseContent(caseContent);

        // Create a new incident record
        const incident = new GlideRecord('incident');
        incident.initialize();
        
        // Set required fields for a valid incident - put affectedNotes prominently in description
        incident.setValue('short_description', caseTitle);
        incident.setValue('description', `${affectedNotes}

==========================================
API SOURCE INFORMATION
==========================================
Incident created via Mondoo Ticketing API
Space ID: ${spaceId}
Original Case Title: ${caseTitle}`);
        incident.setValue('caller_id', gs.getUserID()); // Use current user or system user
        incident.setValue('urgency', urgency); // High urgency for critical security issues (1)
        incident.setValue('impact', impact); // Medium impact (2)
        incident.setValue('priority', priority); // High priority (urgency 1 + impact 2)
        incident.setValue('state', '1'); // New state
        incident.setValue('category', 'Security'); // Security category for this type of issue
        incident.setValue('u_space_id', spaceId); // Custom field to store space_id
        
        // Set work notes and comments
        const currentDateTime = new GlideDateTime().getDisplayValue();
        const workNotesText = `[${currentDateTime}] ${priority} SECURITY INCIDENT - Created automatically via Mondoo Ticketing API

SECURITY DETAILS:
${affectedNotes}

INCIDENT SOURCE:
- Space ID: ${spaceId}
- Case Title: ${caseTitle}
- API Source: Mondoo Ticketing System
- Risk Level: ${riskLevel}
- Affected Assets: ${affectedAssetsCount} system${affectedAssetsCount !== 1 ? 's' : ''}`;
        
        const commentsText = `🚨 CRITICAL SECURITY ALERT 🚨

This incident requires immediate attention due to a critical security finding detected by Mondoo.

SECURITY ISSUE SUMMARY:
${affectedNotes}

ACTION REQUIRED: Please review the attached remediation script and implement the necessary security fixes on all affected assets.

For detailed remediation instructions, see the attached file.`;
        
        incident.setValue('work_notes', workNotesText);
        incident.setValue('comments', commentsText);

        // Insert the record
        const incidentSysId = incident.insert();
        
        if (incidentSysId) {
            try {
                // Retrieve the created incident record for attachment
                const createdIncident = new GlideRecord('incident');
                if (createdIncident.get(incidentSysId)) {
                    // Create attachment with remediation script
                    const attachment = new GlideSysAttachment();
                    const fileName = `remediation_script_${spaceId}_${new GlideDateTime().getNumericValue()}.md`;
                    
                    // Create the attachment using the GlideRecord object
                    attachment.writeBase64(
                        createdIncident,
                        fileName,
                        'text/markdown',
                        gs.base64Encode(remediationScript)
                    );
                    
                    gs.info(`Remediation script attachment created for incident ${incident.getDisplayValue('number')}`);
                } else {
                    gs.error('Could not retrieve created incident for attachment');
                }
                
            } catch (attachmentError) {
                gs.error('Failed to create attachment: ' + attachmentError.toString());
                // Continue without failing the entire request
            }
            
            // Success response
            response.setStatus(201);
            response.getStreamWriter().writeString(JSON.stringify({
                status: 'success',
                message: 'SECURITY INCIDENT created successfully with detailed Mondoo findings',
                incident_number: incident.getDisplayValue('number'),
                incident_sys_id: incidentSysId,
                space_id: spaceId,
                case_title: caseTitle,
                risk_level: riskLevel,
                affected_assets: affectedAssetsCount,
                attachment_included: true
            }));
        } else {
            // Failed to create incident
            response.setStatus(500);
            response.getStreamWriter().writeString(JSON.stringify({
                error: 'Failed to create incident',
                status: 'error'
            }));
        }
        
    } catch (error) {
        // Set Content-Type header even in error cases
        response.setContentType('application/json');
        gs.error('Error in createCaseHandler: ' + error.toString());
        response.setStatus(500);
        response.getStreamWriter().writeString(JSON.stringify({
            error: 'Internal server error: ' + error.toString(),
            status: 'error'
        }));
    }
}]]]]><![CDATA[></content>
    <external_source>false</external_source>
    <path>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/create-case-handler.js</path>
    <sys_name>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/create-case-handler.js</sys_name>
  </sys_module>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_module</target_name>
    <type>Module</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>7fe1063b6e5c3127f95dff6dc8a3e8f8</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_module_3e38eba3aba7446c8ea1d855a9cc035a</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_module action="INSERT_OR_UPDATE">
    <sys_id>3e38eba3aba7446c8ea1d855a9cc035a</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_module_3e38eba3aba7446c8ea1d855a9cc035a</sys_update_name>
    <content><![CDATA[import { gs } from '@servicenow/glide';
import { GlideRecord } from '@servicenow/glide';
import { GlideDateTime } from '@servicenow/glide';
import { GlideSysAttachment } from '@servicenow/glide';
import { RESTAPIRequest, RESTAPIResponse } from '@servicenow/glide/sn_ws_int';

/**
 * Parses case_content to extract overview data, remediation script, risk level, and affected assets count
 * @param {string} caseContent - The markdown-formatted case content
 * @returns {{affectedNotes: string, remediationScript: string, riskLevel: string, affectedAssetsCount: number}}
 */
function parseCaseContent(caseContent) {
    if (!caseContent) {
        return {
            affectedNotes: '',
            remediationScript: '',
            riskLevel: 'Unknown',
            affectedAssetsCount: 0
        };
    }

    let affectedNotes = '';
    let remediationScript = '';
    let riskLevel = 'Unknown';
    let affectedAssetsCount = 0;

    // Extract overview section (from # Overview to # Remediation)
    const overviewMatch = caseContent.match(/# Overview([\s\S]*?)(?=# Remediation|$)/);
    if (overviewMatch) {
        // Include the # Overview heading and trim whitespace
        affectedNotes = ('# Overview' + overviewMatch[1]).trim();
    }

    // Extract remediation script from code block
    // Look for ```shell or ```powershell or ```bash or just ``` followed by the script
    const scriptMatch = caseContent.match(/```(?:shell|powershell|bash)?\n([\s\S]*?)```/);
    if (scriptMatch) {
        remediationScript = scriptMatch[1].trim();
    }

    // Extract risk level from the overview section
    // Looking for patterns like "on 1 asset" or "on 5 assets" in the first paragraph
    const assetCountMatch = caseContent.match(/on (\d+) assets?/i);
    if (assetCountMatch) {
        affectedAssetsCount = parseInt(assetCountMatch[1], 10);
    }

    // Extract risk level from the Scoring section
    // Looking for |Risk|<value>| in the table
    const riskMatch = caseContent.match(/\|Risk\|([^|\n]+)\|/i);
    if (riskMatch) {
        riskLevel = riskMatch[1].trim();
    }

    // Extract risk value for more detailed risk level
    const riskValueMatch = caseContent.match(/\|Risk value\|(\d+)\s*\/\s*100\|/i);
    if (riskValueMatch) {
        const riskValue = riskValueMatch[1];
        riskLevel = `${riskLevel} (${riskValue}/100)`;
    }

    return {
        affectedNotes,
        remediationScript,
        riskLevel,
        affectedAssetsCount
    };
}

export function updateCaseHandler(request, response) {
    try {
        // Set Content-Type header for JSON response
        response.setContentType('application/json');

        // Parse the request body
        const requestBody = request.body;
        const data = requestBody.data;

        if (!data) {
            response.setStatus(400);
            response.getStreamWriter().writeString(JSON.stringify({
                error: 'Missing data in request body',
                status: 'error'
            }));
            return;
        }

        const incidentSysId = data.incident_sys_id;
        const caseTitle = data.title;
        const caseContent = data.content;
        const urgency = data.urgency;
        const impact = data.impact;
        const priority = data.priority;

        // Validate required fields
        if (!incidentSysId) {
            response.setStatus(400);
            response.getStreamWriter().writeString(JSON.stringify({
                error: 'Missing required field: incident_sys_id is required',
                status: 'error'
            }));
            return;
        }

        // Find the incident record
        const incident = new GlideRecord('incident');
        if (!incident.get(incidentSysId)) {
            response.setStatus(404);
            response.getStreamWriter().writeString(JSON.stringify({
                error: 'Incident not found',
                status: 'error',
                incident_sys_id: incidentSysId
            }));
            return;
        }

        // Parse the case content to extract overview, remediation script, risk level, and affected assets count
        const { affectedNotes, remediationScript, riskLevel, affectedAssetsCount } = parseCaseContent(caseContent);

        // Update fields only if provided
        if (caseTitle) {
            incident.setValue('short_description', caseTitle);
        }

        if (caseContent) {
            incident.setValue('description', `${affectedNotes}

==========================================
API SOURCE INFORMATION
==========================================
Incident updated via Mondoo Ticketing API
Space ID: ${incident.getValue('u_space_id')}
Case Title: ${caseTitle || incident.getValue('short_description')}`);
        }

        if (urgency) {
            incident.setValue('urgency', urgency);
        }

        if (impact) {
            incident.setValue('impact', impact);
        }

        if (priority) {
            incident.setValue('priority', priority);
        }

        // Add work notes about the update
        const currentDateTime = new GlideDateTime().getDisplayValue();
        const updateNotes = `[${currentDateTime}] Incident updated via Mondoo Ticketing API

UPDATED SECURITY DETAILS:
${affectedNotes}

UPDATE SOURCE:
- Space ID: ${incident.getValue('u_space_id')}
- Case Title: ${caseTitle || incident.getValue('short_description')}
- API Source: Mondoo Ticketing System
- Risk Level: ${riskLevel}
- Affected Assets: ${affectedAssetsCount} system${affectedAssetsCount !== 1 ? 's' : ''}`;

        // Append to existing work notes
        const existingWorkNotes = incident.getValue('work_notes') || '';
        incident.setValue('work_notes', existingWorkNotes + '\n\n' + updateNotes);

        // Update the record
        const updated = incident.update();

        if (updated) {
            // If remediation script is provided, create a new attachment
            if (remediationScript) {
                try {
                    const attachment = new GlideSysAttachment();
                    const fileName = `remediation_script_${incident.getValue('u_space_id')}_${new GlideDateTime().getNumericValue()}.md`;

                    // Create the attachment using the GlideRecord object
                    attachment.writeBase64(
                        incident,
                        fileName,
                        'text/markdown',
                        gs.base64Encode(remediationScript)
                    );

                    gs.info(`Updated remediation script attachment created for incident ${incident.getDisplayValue('number')}`);
                } catch (attachmentError) {
                    gs.error('Failed to create attachment: ' + attachmentError.toString());
                    // Continue without failing the entire request
                }
            }

            // Success response
            response.setStatus(200);
            response.getStreamWriter().writeString(JSON.stringify({
                status: 'success',
                message: 'Incident updated successfully',
                incident_number: incident.getDisplayValue('number'),
                incident_sys_id: incidentSysId,
                space_id: incident.getValue('u_space_id'),
                case_title: caseTitle || incident.getValue('short_description'),
                risk_level: riskLevel,
                affected_assets: affectedAssetsCount
            }));
        } else {
            // Failed to update incident
            response.setStatus(500);
            response.getStreamWriter().writeString(JSON.stringify({
                error: 'Failed to update incident',
                status: 'error'
            }));
        }

    } catch (error) {
        // Set Content-Type header even in error cases
        response.setContentType('application/json');
        gs.error('Error in updateCaseHandler: ' + error.toString());
        response.setStatus(500);
        response.getStreamWriter().writeString(JSON.stringify({
            error: 'Internal server error: ' + error.toString(),
            status: 'error'
        }));
    }
}
]]]]><![CDATA[></content>
    <external_source>false</external_source>
    <path>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/update-case-handler.js</path>
    <sys_name>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/update-case-handler.js</sys_name>
  </sys_module>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_module</target_name>
    <type>Module</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>7ff9c6cca4d7e07ce93af24c89499a25</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_module_45caeab1b22f4c9cb1220e50c984ed11</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_module action="INSERT_OR_UPDATE">
    <sys_id>45caeab1b22f4c9cb1220e50c984ed11</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <path>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/bom.json</path>
    <external_source>false</external_source>
    <content><![CDATA[{
  "$schema": "http://cyclonedx.org/schema/bom-1.6.schema.json",
  "bomFormat": "CycloneDX",
  "specVersion": "1.6",
  "version": 1,
  "serialNumber": "urn:uuid:1a70bb27-fabc-4bbd-bec8-ef4251c284f2",
  "metadata": {
    "timestamp": "2026-09-08T11:41:59.881Z",
    "tools": {
      "components": [
        {
          "type": "library",
          "name": "sdk-build-plugins",
          "group": "@servicenow",
          "version": "4.1.0",
          "author": "ServiceNow"
        }
      ]
    },
    "component": {
      "type": "application",
      "name": "x-1877227-mondooticket",
      "version": "1.0.0",
      "bom-ref": "pkg:servicenow/x-1877227-mondooticket@1.0.0?sys_scope_id=1bb16cc3936932104c0b70aefaba10b6",
      "description": "[BUILD AGENT GENERATED]:  A ticketing system that provides REST API endpoints to create ServiceNow incidents from external systems",
      "licenses": [
        {
          "license": {
            "name": "UNLICENSED"
          }
        }
      ],
      "purl": "pkg:servicenow/x-1877227-mondooticket@1.0.0?sys_scope_id=1bb16cc3936932104c0b70aefaba10b6"
    }
  },
  "components": [],
  "dependencies": [
    {
      "ref": "pkg:servicenow/x-1877227-mondooticket@1.0.0?sys_scope_id=1bb16cc3936932104c0b70aefaba10b6"
    }
  ]
}]]]]><![CDATA[></content>
  </sys_module>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_module</target_name>
    <type>Module</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>b0ca7eab11046b866220172afe09dbac</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_module_7805cfc066ea461584b6fec2c4503421</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_module action="INSERT_OR_UPDATE">
    <sys_id>7805cfc066ea461584b6fec2c4503421</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_module_7805cfc066ea461584b6fec2c4503421</sys_update_name>
    <content><![CDATA[import { gs } from '@servicenow/glide';
import { GlideRecord } from '@servicenow/glide';
import { GlideDateTime } from '@servicenow/glide';
import { RESTAPIRequest, RESTAPIResponse } from '@servicenow/glide/sn_ws_int';

export function deleteCaseHandler(request, response) {
    try {
        // Set Content-Type header for JSON response
        response.setContentType('application/json');

        // Parse the request body
        const requestBody = request.body;
        const data = requestBody.data;

        if (!data) {
            response.setStatus(400);
            response.getStreamWriter().writeString(JSON.stringify({
                error: 'Missing data in request body',
                status: 'error'
            }));
            return;
        }

        const incidentSysId = data.incident_sys_id;

        // Validate required fields
        if (!incidentSysId) {
            response.setStatus(400);
            response.getStreamWriter().writeString(JSON.stringify({
                error: 'Missing required field: incident_sys_id is required',
                status: 'error'
            }));
            return;
        }

        // Find the incident record
        const incident = new GlideRecord('incident');
        if (!incident.get(incidentSysId)) {
            response.setStatus(404);
            response.getStreamWriter().writeString(JSON.stringify({
                error: 'Incident not found',
                status: 'error',
                incident_sys_id: incidentSysId
            }));
            return;
        }

        // Store incident details before deletion for response
        const incidentNumber = incident.getDisplayValue('number');
        const incidentTitle = incident.getValue('short_description');
        const spaceId = incident.getValue('u_space_id');

        // Log the deletion
        gs.info(`Deleting incident ${incidentNumber} (sys_id: ${incidentSysId}) via Mondoo Ticketing API`);

        // Delete the incident record
        const deleted = incident.deleteRecord();

        if (deleted) {
            // Success response
            response.setStatus(200);
            response.getStreamWriter().writeString(JSON.stringify({
                status: 'success',
                message: 'Incident deleted successfully',
                incident_number: incidentNumber,
                incident_sys_id: incidentSysId,
                incident_title: incidentTitle,
                space_id: spaceId
            }));
        } else {
            // Failed to delete incident
            response.setStatus(500);
            response.getStreamWriter().writeString(JSON.stringify({
                error: 'Failed to delete incident',
                status: 'error',
                incident_sys_id: incidentSysId
            }));
        }

    } catch (error) {
        // Set Content-Type header even in error cases
        response.setContentType('application/json');
        gs.error('Error in deleteCaseHandler: ' + error.toString());
        response.setStatus(500);
        response.getStreamWriter().writeString(JSON.stringify({
            error: 'Internal server error: ' + error.toString(),
            status: 'error'
        }));
    }
}
]]]]><![CDATA[></content>
    <external_source>false</external_source>
    <path>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/delete-case-handler.js</path>
    <sys_name>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/delete-case-handler.js</sys_name>
  </sys_module>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_module</target_name>
    <type>Module</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>f15c971391559423c37744f40d731720</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_module_8f6c993900844bc7a1eecbd9cb6ae361</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_module action="INSERT_OR_UPDATE">
    <sys_id>8f6c993900844bc7a1eecbd9cb6ae361</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_module_8f6c993900844bc7a1eecbd9cb6ae361</sys_update_name>
    <content><![CDATA[import { gs } from '@servicenow/glide';
import { GlideRecord } from '@servicenow/glide';

/**
 * Gets the current OAuth configuration status
 * Checks for certificate, user, and OAuth entity existence
 *
 * All OAuth components must be configured manually in ServiceNow UI:
 * OIDC id token grant inbound integration (OAuth entity)
 */
export function getOAuthStatus() {
    gs.info('=== CHECKING OAUTH CONFIGURATION STATUS ===');

    // Check OAuth entity
    const oauthEntity = new GlideRecord('oauth_entity');
    oauthEntity.addQuery('name', 'Mondoo');
    oauthEntity.query();

    let oauthExists = false;
    if (oauthEntity.next()) {
        oauthExists = true;
        gs.info('✓ OAuth entity found: ' + oauthEntity.getValue('name'));
    } else {
        gs.info('✗ OAuth entity NOT found (name: Mondoo)');
    }

    const configured = oauthExists;

    const status = {
        configured: configured,
        oauthExists: oauthExists,
        message: configured
            ? 'OAuth is fully configured'
            : 'OAuth configuration incomplete. Please configure all required components manually.'
    };

    gs.info('Status summary: configured=' + configured + ', oauthExists=' + oauthExists);
    return status;
}
]]]]><![CDATA[></content>
    <external_source>false</external_source>
    <path>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/configure-oauth.js</path>
    <sys_name>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/configure-oauth.js</sys_name>
  </sys_module>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_module</target_name>
    <type>Module</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>18146676eb74348fa1eba99e8491daf3</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_module_b577186990424699bca7f9f2ce52dc71</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_module action="INSERT_OR_UPDATE">
    <sys_id>b577186990424699bca7f9f2ce52dc71</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_module_b577186990424699bca7f9f2ce52dc71</sys_update_name>
    <content><![CDATA[{
  "name": "x-1877227-mondooticket",
  "version": "1.0.0",
  "description": "[BUILD AGENT GENERATED]:  A ticketing system that provides REST API endpoints to create ServiceNow incidents from external systems",
  "license": "UNLICENSED",
  "scripts": {
    "build": "now-sdk build",
    "deploy": "now-sdk install",
    "transform": "now-sdk transform",
    "types": "now-sdk dependencies",
    "update-set": "node scripts/generate-update-set.js"
  },
  "devDependencies": {
    "@servicenow/sdk": "4.1.0",
    "@servicenow/glide": "26.0.1",
    "eslint": "8.50.0",
    "@servicenow/eslint-plugin-sdk-app-plugin": "4.1.0"
  }
}]]]]><![CDATA[></content>
    <external_source>false</external_source>
    <path>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/package.json</path>
    <sys_name>x_1877227_mondooti/x-1877227-mondooticket/1.0.0/package.json</sys_name>
  </sys_module>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_module</target_name>
    <type>Module</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>33851f8311d78b0562e1629c6a8d5667</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_scope_privilege_3663ec87936932104c0b70aefaba1041</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_scope_privilege action="INSERT_OR_UPDATE">
    <sys_id>3663ec87936932104c0b70aefaba1041</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_scope_privilege_3663ec87936932104c0b70aefaba1041</sys_update_name>
    <operation>execute</operation>
    <source_scope>1bb16cc3936932104c0b70aefaba10b6</source_scope>
    <status>allowed</status>
    <target_name>RESTAPIRequestBody</target_name>
    <target_scope>global</target_scope>
    <target_type>scriptable</target_type>
  </sys_scope_privilege>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_scope_privilege</target_name>
    <type>Application Cross-Scope Access</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>eb2ad7a003f729a7f4ba1e8df1988720</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_scope_privilege_3e63ec87936932104c0b70aefaba1039</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_scope_privilege action="INSERT_OR_UPDATE">
    <sys_id>3e63ec87936932104c0b70aefaba1039</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_scope_privilege_3e63ec87936932104c0b70aefaba1039</sys_update_name>
    <operation>execute</operation>
    <source_scope>1bb16cc3936932104c0b70aefaba10b6</source_scope>
    <status>allowed</status>
    <target_name>RESTAPIRequest</target_name>
    <target_scope>global</target_scope>
    <target_type>scriptable</target_type>
  </sys_scope_privilege>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_scope_privilege</target_name>
    <type>Application Cross-Scope Access</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>490131b56ff34e7c4a5ab4c28faa56e0</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_scope_privilege_4763e0c7936932104c0b70aefaba1017</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_scope_privilege action="INSERT_OR_UPDATE">
    <sys_id>4763e0c7936932104c0b70aefaba1017</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_scope_privilege_4763e0c7936932104c0b70aefaba1017</sys_update_name>
    <operation>execute</operation>
    <source_scope>1bb16cc3936932104c0b70aefaba10b6</source_scope>
    <status>allowed</status>
    <target_name>ScriptableServiceResultBuilder.setStatus</target_name>
    <target_scope>global</target_scope>
    <target_type>scriptable</target_type>
  </sys_scope_privilege>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_scope_privilege</target_name>
    <type>Application Cross-Scope Access</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>f199a1710f7840e3b0ccd72b9548479a</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_scope_privilege_7a63a0c7936932104c0b70aefaba10dd</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_scope_privilege action="INSERT_OR_UPDATE">
    <sys_id>7a63a0c7936932104c0b70aefaba10dd</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_scope_privilege_7a63a0c7936932104c0b70aefaba10dd</sys_update_name>
    <operation>execute</operation>
    <source_scope>1bb16cc3936932104c0b70aefaba10b6</source_scope>
    <status>allowed</status>
    <target_name>GlideRecord.setValue</target_name>
    <target_scope>global</target_scope>
    <target_type>scriptable</target_type>
  </sys_scope_privilege>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_scope_privilege</target_name>
    <type>Application Cross-Scope Access</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>28d53591fb06e515fcdb2bdd1d96956e</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_scope_privilege_7b4c208b93a932104c0b70aefaba10ab</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_scope_privilege action="INSERT_OR_UPDATE">
    <sys_id>7b4c208b93a932104c0b70aefaba10ab</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_scope_privilege_7b4c208b93a932104c0b70aefaba10ab</sys_update_name>
    <operation>execute</operation>
    <source_scope>1bb16cc3936932104c0b70aefaba10b6</source_scope>
    <status>allowed</status>
    <target_name>Glide API: string utilities</target_name>
    <target_scope>global</target_scope>
    <target_type>scriptable</target_type>
  </sys_scope_privilege>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_scope_privilege</target_name>
    <type>Application Cross-Scope Access</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>bc22de729d8a4080ad108c647534de62</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_scope_privilege_7b4cac4b93a932104c0b70aefaba1012</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_scope_privilege action="INSERT_OR_UPDATE">
    <sys_id>7b4cac4b93a932104c0b70aefaba1012</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_scope_privilege_7b4cac4b93a932104c0b70aefaba1012</sys_update_name>
    <operation>execute</operation>
    <source_scope>1bb16cc3936932104c0b70aefaba10b6</source_scope>
    <status>allowed</status>
    <target_name>GlideSysAttachment.writeBase64</target_name>
    <target_scope>global</target_scope>
    <target_type>scriptable</target_type>
  </sys_scope_privilege>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_scope_privilege</target_name>
    <type>Application Cross-Scope Access</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>840cfb812d6924f060c292f98c4d5c7f</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_scope_privilege_7fc3200b936932104c0b70aefaba10bc</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_scope_privilege action="INSERT_OR_UPDATE">
    <sys_id>7fc3200b936932104c0b70aefaba10bc</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_scope_privilege_7fc3200b936932104c0b70aefaba10bc</sys_update_name>
    <operation>execute</operation>
    <source_scope>1bb16cc3936932104c0b70aefaba10b6</source_scope>
    <status>allowed</status>
    <target_name>ScriptableServiceResultBuilder.setContentType</target_name>
    <target_scope>global</target_scope>
    <target_type>scriptable</target_type>
  </sys_scope_privilege>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_scope_privilege</target_name>
    <type>Application Cross-Scope Access</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>a8009978a5a2c87d4677d23eebcfcf2e</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_scope_privilege_8b63e0c7936932104c0b70aefaba102b</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_scope_privilege action="INSERT_OR_UPDATE">
    <sys_id>8b63e0c7936932104c0b70aefaba102b</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_scope_privilege_8b63e0c7936932104c0b70aefaba102b</sys_update_name>
    <operation>execute</operation>
    <source_scope>1bb16cc3936932104c0b70aefaba10b6</source_scope>
    <status>allowed</status>
    <target_name>ScriptableServiceResultStreamWriter.writeString</target_name>
    <target_scope>global</target_scope>
    <target_type>scriptable</target_type>
  </sys_scope_privilege>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_scope_privilege</target_name>
    <type>Application Cross-Scope Access</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>c80d36cb991775048b0c28e564c88076</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_scope_privilege_ba63a0c7936932104c0b70aefaba10e1</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_scope_privilege action="INSERT_OR_UPDATE">
    <sys_id>ba63a0c7936932104c0b70aefaba10e1</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_scope_privilege_ba63a0c7936932104c0b70aefaba10e1</sys_update_name>
    <operation>execute</operation>
    <source_scope>1bb16cc3936932104c0b70aefaba10b6</source_scope>
    <status>allowed</status>
    <target_name>GlideRecord.insert</target_name>
    <target_scope>global</target_scope>
    <target_type>scriptable</target_type>
  </sys_scope_privilege>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_scope_privilege</target_name>
    <type>Application Cross-Scope Access</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>aef8cd7eb71090204fa5780ad9f8077f</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_scope_privilege_cb63e0c7936932104c0b70aefaba1027</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_scope_privilege action="INSERT_OR_UPDATE">
    <sys_id>cb63e0c7936932104c0b70aefaba1027</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_scope_privilege_cb63e0c7936932104c0b70aefaba1027</sys_update_name>
    <operation>execute</operation>
    <source_scope>1bb16cc3936932104c0b70aefaba10b6</source_scope>
    <status>allowed</status>
    <target_name>ScriptableServiceResultBuilder.getStreamWriter</target_name>
    <target_scope>global</target_scope>
    <target_type>scriptable</target_type>
  </sys_scope_privilege>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_scope_privilege</target_name>
    <type>Application Cross-Scope Access</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>50c482c9f57e04de2b7153d0d9032492</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_scope_privilege_fa63a0c7936932104c0b70aefaba10e5</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_scope_privilege action="INSERT_OR_UPDATE">
    <sys_id>fa63a0c7936932104c0b70aefaba10e5</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_scope_privilege_fa63a0c7936932104c0b70aefaba10e5</sys_update_name>
    <operation>create</operation>
    <source_scope>1bb16cc3936932104c0b70aefaba10b6</source_scope>
    <status>allowed</status>
    <target_name>incident</target_name>
    <target_scope>global</target_scope>
    <target_type>sys_db_object</target_type>
  </sys_scope_privilege>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_scope_privilege</target_name>
    <type>Application Cross-Scope Access</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>6bc90f1f1f72e134673b9c4015ebb423</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_script_include_8f926bebf24e42aa96e7fc9b78ee59b3</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_script_include action="INSERT_OR_UPDATE">
    <sys_id>8f926bebf24e42aa96e7fc9b78ee59b3</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_script_include_8f926bebf24e42aa96e7fc9b78ee59b3</sys_update_name>
    <access>package_private</access>
    <active>true</active>
    <api_name>x_1877227_mondooti.MondooOAuthConfig</api_name>
    <caller_access/>
    <client_callable>true</client_callable>
    <description>Provides OAuth configuration status for Mondoo integration</description>
    <mobile_callable>false</mobile_callable>
    <name>MondooOAuthConfig</name>
    <sandbox_callable>false</sandbox_callable>
    <script><![CDATA[
        var MondooOAuthConfig = Class.create();
        MondooOAuthConfig.prototype = {

            initialize: function() {
                // Constructor
            },

            getOAuthStatus: function() {
                gs.info('=== CHECKING OAUTH CONFIGURATION STATUS ===');

                // Check user
                var user = new GlideRecord('sys_user');
                user.addQuery('email', 'support@mondoo.com');
                user.query();

                var userExists = false;
                if (user.next()) {
                    userExists = true;
                    gs.info('✓ User found: ' + user.getValue('email'));
                } else {
                    gs.info('✗ User NOT found (email: support@mondoo.com)');
                }

                // Check OAuth entity (OIDC provider in Application Registry)
                var oauthEntity = new GlideRecord('oauth_entity');
                oauthEntity.addQuery('name', 'Mondoo');
                oauthEntity.query();

                var oauthExists = false;
                var clientId = '';
                if (oauthEntity.next()) {
                    oauthExists = true;
                    clientId = oauthEntity.getValue('client_id');
                    gs.info('✓ OAuth entity found: ' + oauthEntity.getValue('name') + ' (client_id: ' + clientId + ')');
                } else {
                    gs.info('✗ OAuth entity NOT found (name: Mondoo)');
                }

                var configured = userExists && oauthExists;

                var status = {
                    configured: configured,
                    userExists: userExists,
                    oauthExists: oauthExists,
                    clientId: clientId,
                    message: configured
                        ? 'OAuth is fully configured'
                        : 'OAuth configuration incomplete. Please configure all required components manually.'
                };

                gs.info('Status summary: configured=' + configured + ', + userExists=' + userExists + ', oauthExists=' + oauthExists + ', clientId=' + clientId);
                return status;
            },

            type: 'MondooOAuthConfig'
        };
    ]]]]><![CDATA[></script>
    <sys_policy/>
  </sys_script_include>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_script_include</target_name>
    <type>Script Include</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>c6e41f853173a8e5674ba5547fa45f0a</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_ws_definition_61efcc87c6a044c0a5fac3e545328ae3</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_ws_definition action="INSERT_OR_UPDATE">
    <sys_id>61efcc87c6a044c0a5fac3e545328ae3</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_ws_definition_61efcc87c6a044c0a5fac3e545328ae3</sys_update_name>
    <active>true</active>
    <base_uri>/api/x_1877227_mondooti/mondoo_ticketing</base_uri>
    <consumes>application/json</consumes>
    <consumes_customized>true</consumes_customized>
    <default_version>No active default version</default_version>
    <doc_link/>
    <enforce_acl>cf9d01d3e73003009d6247e603f6a990</enforce_acl>
    <is_versioned>false</is_versioned>
    <name>Mondoo Ticketing API</name>
    <namespace>x_1877227_mondooti</namespace>
    <produces>application/json</produces>
    <produces_customized>true</produces_customized>
    <service_id>mondoo_ticketing</service_id>
    <short_description>Authenticated API for Mondoo token exchange and case management</short_description>
    <sys_policy/>
  </sys_ws_definition>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_ws_definition</target_name>
    <type>Scripted REST API</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>cb841ceea0b939ed721222578f1c04fc</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_ws_definition_9459b55865924a7e9ec71ed239ecc90c</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_ws_definition action="INSERT_OR_UPDATE">
    <sys_id>9459b55865924a7e9ec71ed239ecc90c</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_ws_definition_9459b55865924a7e9ec71ed239ecc90c</sys_update_name>
    <active>true</active>
    <base_uri>/api/x_1877227_mondooti/mondoo_health</base_uri>
    <consumes>application/json</consumes>
    <consumes_customized>true</consumes_customized>
    <default_version>No active default version</default_version>
    <doc_link/>
    <enforce_acl/>
    <is_versioned>false</is_versioned>
    <name>Mondoo Health API</name>
    <namespace>x_1877227_mondooti</namespace>
    <produces>application/json</produces>
    <produces_customized>true</produces_customized>
    <service_id>mondoo_health</service_id>
    <short_description>API for Mondoo health checks</short_description>
    <sys_policy/>
  </sys_ws_definition>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_ws_definition</target_name>
    <type>Scripted REST API</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>b8fee93928efbc892d2bfd39358d8e84</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_ws_operation_7857c5a7025b43ccba6b81a74c057b14</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_ws_operation action="INSERT_OR_UPDATE">
    <sys_id>7857c5a7025b43ccba6b81a74c057b14</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_ws_operation_7857c5a7025b43ccba6b81a74c057b14</sys_update_name>
    <active>true</active>
    <consumes>application/json</consumes>
    <consumes_customized>false</consumes_customized>
    <default_operation_uri>/api/x_1877227_mondooti/mondoo_health/health</default_operation_uri>
    <enforce_acl>cf9d01d3e73003009d6247e603f6a990</enforce_acl>
    <http_method>GET</http_method>
    <name>Health Check</name>
    <operation_script><![CDATA[
                (function process(request, response) {
                    try {
                        var oauthConfig = new x_1877227_mondooti.MondooOAuthConfig();
                        var oauthStatus = oauthConfig.getOAuthStatus();

                        var healthData = {
                            status: 'healthy',
                            service: 'Mondoo Case Management API',
                            timestamp: new GlideDateTime().getDisplayValue(),
                            version: '1.0.0',
                            oauth_configured: oauthStatus.configured,
                            client_id: oauthStatus.clientId,
                            oauth_details: {
                                certificate: oauthStatus.certExists,
                                user: oauthStatus.userExists,
                                oauth_entity: oauthStatus.oauthExists
                            }
                        };

                        response.setStatus(200);
                        response.setHeader('Content-Type', 'application/json');
                        response.getStreamWriter().writeString(JSON.stringify(healthData));

                    } catch (e) {
                        var errorResponse = {
                            status: 'error',
                            service: 'Mondoo Case Management API',
                            timestamp: new GlideDateTime().getDisplayValue(),
                            error: e.message
                        };

                        response.setStatus(500);
                        response.setHeader('Content-Type', 'application/json');
                        response.getStreamWriter().writeString(JSON.stringify(errorResponse));
                    }
                })(request, response);
            ]]]]><![CDATA[></operation_script>
    <operation_uri>/api/x_1877227_mondooti/mondoo_health/health</operation_uri>
    <produces>application/json</produces>
    <produces_customized>false</produces_customized>
    <relative_path>/health</relative_path>
    <request_example/>
    <requires_acl_authorization>false</requires_acl_authorization>
    <requires_authentication>false</requires_authentication>
    <requires_snc_internal_role>true</requires_snc_internal_role>
    <short_description>Unauthenticated health check endpoint</short_description>
    <sys_policy/>
    <web_service_definition>9459b55865924a7e9ec71ed239ecc90c</web_service_definition>
    <web_service_version/>
  </sys_ws_operation>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_ws_operation</target_name>
    <type>Scripted REST Resource</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>8f578417b7a0c9183ed07758b8ab1a77</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_ws_operation_866e28cbdc614265b0018de0dd414016</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_ws_operation action="INSERT_OR_UPDATE">
    <sys_id>866e28cbdc614265b0018de0dd414016</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_ws_operation_866e28cbdc614265b0018de0dd414016</sys_update_name>
    <active>true</active>
    <consumes>application/json</consumes>
    <consumes_customized>false</consumes_customized>
    <default_operation_uri>/api/x_1877227_mondooti/mondoo_ticketing/create</default_operation_uri>
    <enforce_acl>cf9d01d3e73003009d6247e603f6a990</enforce_acl>
    <http_method>POST</http_method>
    <name>Create Case</name>
    <operation_script><![CDATA[// @fluent-module createCaseHandler;false;x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/create-case-handler.js
// WARNING: This code is generated by the ServiceNow SDK in order to provide
// support for modular JavaScript. Modifications of any kind are likely to
// result in unintended behavior. In most cases, you should edit the source
// file of the module imported below. If you are absolutely certain you want
// to take control of this code, you can remove this comment to prevent the
// SDK from regenerating it. However, you will then be responsible for the
// management of this code in your Fluent file.
const { createCaseHandler } = require('x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/create-case-handler.js');
createCaseHandler(request, response);]]]]><![CDATA[></operation_script>
    <operation_uri>/api/x_1877227_mondooti/mondoo_ticketing/create</operation_uri>
    <produces>application/json</produces>
    <produces_customized>false</produces_customized>
    <relative_path>/create</relative_path>
    <request_example/>
    <requires_acl_authorization>true</requires_acl_authorization>
    <requires_authentication>true</requires_authentication>
    <requires_snc_internal_role>true</requires_snc_internal_role>
    <short_description>Authenticated endpoint to create a new case from Mondoo data</short_description>
    <sys_policy/>
    <web_service_definition>61efcc87c6a044c0a5fac3e545328ae3</web_service_definition>
    <web_service_version/>
  </sys_ws_operation>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_ws_operation</target_name>
    <type>Scripted REST Resource</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>3dee66e50d0ccafe30752d8b583ac08b</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_ws_operation_b858d872bb794ae6902c6e0a8a37728b</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_ws_operation action="INSERT_OR_UPDATE">
    <sys_id>b858d872bb794ae6902c6e0a8a37728b</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_ws_operation_b858d872bb794ae6902c6e0a8a37728b</sys_update_name>
    <active>true</active>
    <consumes>application/json</consumes>
    <consumes_customized>false</consumes_customized>
    <default_operation_uri>/api/x_1877227_mondooti/mondoo_ticketing/update</default_operation_uri>
    <enforce_acl>cf9d01d3e73003009d6247e603f6a990</enforce_acl>
    <http_method>POST</http_method>
    <name>Update Case</name>
    <operation_script><![CDATA[// @fluent-module updateCaseHandler;false;x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/update-case-handler.js
// WARNING: This code is generated by the ServiceNow SDK in order to provide
// support for modular JavaScript. Modifications of any kind are likely to
// result in unintended behavior. In most cases, you should edit the source
// file of the module imported below. If you are absolutely certain you want
// to take control of this code, you can remove this comment to prevent the
// SDK from regenerating it. However, you will then be responsible for the
// management of this code in your Fluent file.
const { updateCaseHandler } = require('x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/update-case-handler.js');
updateCaseHandler(request, response);]]]]><![CDATA[></operation_script>
    <operation_uri>/api/x_1877227_mondooti/mondoo_ticketing/update</operation_uri>
    <produces>application/json</produces>
    <produces_customized>false</produces_customized>
    <relative_path>/update</relative_path>
    <request_example/>
    <requires_acl_authorization>true</requires_acl_authorization>
    <requires_authentication>true</requires_authentication>
    <requires_snc_internal_role>true</requires_snc_internal_role>
    <short_description>Authenticated endpoint to update an existing case from Mondoo data</short_description>
    <sys_policy/>
    <web_service_definition>61efcc87c6a044c0a5fac3e545328ae3</web_service_definition>
    <web_service_version/>
  </sys_ws_operation>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_ws_operation</target_name>
    <type>Scripted REST Resource</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

  <sys_update_xml action="INSERT_OR_UPDATE">
    <sys_id>d7cf49e22ac2c1543610be710393c8f8</sys_id>
    <action>INSERT_OR_UPDATE</action>
    <application display_value="Global">global</application>
    <name>sys_ws_operation_d0c09848eca647098637df6ff3d80d95</name>
    <payload><![CDATA[<?xml version="1.0"?>
<record_update>
  <sys_ws_operation action="INSERT_OR_UPDATE">
    <sys_id>d0c09848eca647098637df6ff3d80d95</sys_id>
    <sys_scope display_value="x_1877227_mondooti">1bb16cc3936932104c0b70aefaba10b6</sys_scope>
    <sys_update_name>sys_ws_operation_d0c09848eca647098637df6ff3d80d95</sys_update_name>
    <active>true</active>
    <consumes>application/json</consumes>
    <consumes_customized>false</consumes_customized>
    <default_operation_uri>/api/x_1877227_mondooti/mondoo_ticketing/delete</default_operation_uri>
    <enforce_acl>cf9d01d3e73003009d6247e603f6a990</enforce_acl>
    <http_method>POST</http_method>
    <name>Delete Case</name>
    <operation_script><![CDATA[// @fluent-module deleteCaseHandler;false;x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/delete-case-handler.js
// WARNING: This code is generated by the ServiceNow SDK in order to provide
// support for modular JavaScript. Modifications of any kind are likely to
// result in unintended behavior. In most cases, you should edit the source
// file of the module imported below. If you are absolutely certain you want
// to take control of this code, you can remove this comment to prevent the
// SDK from regenerating it. However, you will then be responsible for the
// management of this code in your Fluent file.
const { deleteCaseHandler } = require('x_1877227_mondooti/x-1877227-mondooticket/1.0.0/src/server/delete-case-handler.js');
deleteCaseHandler(request, response);]]]]><![CDATA[></operation_script>
    <operation_uri>/api/x_1877227_mondooti/mondoo_ticketing/delete</operation_uri>
    <produces>application/json</produces>
    <produces_customized>false</produces_customized>
    <relative_path>/delete</relative_path>
    <request_example/>
    <requires_acl_authorization>true</requires_acl_authorization>
    <requires_authentication>true</requires_authentication>
    <requires_snc_internal_role>true</requires_snc_internal_role>
    <short_description>Authenticated endpoint to delete a case from Mondoo data</short_description>
    <sys_policy/>
    <web_service_definition>61efcc87c6a044c0a5fac3e545328ae3</web_service_definition>
    <web_service_version/>
  </sys_ws_operation>
</record_update>]]></payload>
    <remote_update_set display_value="Mondooticket v1.0.0">4859238546be9220c4dd16b7539c6aa1</remote_update_set>
    <target_name>sys_ws_operation</target_name>
    <type>Scripted REST Resource</type>
    <update_set>4859238546be9220c4dd16b7539c6aa1</update_set>
  </sys_update_xml>

</unload>
