/** This is an automatically generated code sample. 
To make this code sample work in your Oracle Cloud tenancy, 
please replace the values for any parameters whose current values do not fit
your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and 
boolean, number, and enum parameters with values not fitting your use case).
*/

import com.oracle.bmc.ConfigFileReader;
import com.oracle.bmc.auth.AuthenticationDetailsProvider;
import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
import com.oracle.bmc.cims.IncidentClient;
import com.oracle.bmc.cims.model.*;
import com.oracle.bmc.cims.requests.*;
import com.oracle.bmc.cims.responses.*;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Date;
import java.util.Arrays;


public class CreateIncidentExample {
    public static void main(String[] args) throws Exception {

        /**
         * Create a default authentication provider that uses the DEFAULT
         * profile in the configuration file.
         * Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
         */
        final ConfigFileReader.ConfigFile configFile = ConfigFileReader.parseDefault();
        final AuthenticationDetailsProvider provider = new ConfigFileAuthenticationDetailsProvider(configFile);

        /* Create a service client */
        IncidentClient client = new IncidentClient(provider);

        /* Create a request and dependent object(s). */
	CreateIncident createIncident = CreateIncident.builder()
		.compartmentId("ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value")
		.ticket(CreateTicketDetails.builder()
			.severity(CreateTicketDetails.Severity.Medium)
			.resourceList(new ArrayList<>(Arrays.asList(CreateResourceDetails.builder()
					.item(CreateTechSupportItemDetails.builder()
						.category(CreateCategoryDetails.builder()
							.categoryKey("EXAMPLE-categoryKey-Value").build())
						.subCategory(CreateSubCategoryDetails.builder()
							.subCategoryKey("EXAMPLE-subCategoryKey-Value").build())
						.issueType(CreateIssueTypeDetails.builder()
							.issueTypeKey("EXAMPLE-issueTypeKey-Value").build())
						.name("EXAMPLE-name-Value").build())
					.region(Region.Iad)
					.availabilityDomain(AvailabilityDomain.ApTokyo1Ad1).build())))
			.title("EXAMPLE-title-Value")
			.description("EXAMPLE-description-Value")
			.contextualData(ContextualData.builder()
				.clientId("ocid1.test.oc1..<unique_ID>EXAMPLE-clientId-Value")
				.schemaName("EXAMPLE-schemaName-Value")
				.schemaVersion("EXAMPLE-schemaVersion-Value")
				.payload("EXAMPLE-payload-Value").build()).build())
		.csi("EXAMPLE-csi-Value")
		.problemType(ProblemType.Tech)
		.contacts(new ArrayList<>(Arrays.asList(Contact.builder()
				.contactName("EXAMPLE-contactName-Value")
				.contactEmail("EXAMPLE-contactEmail-Value")
				.contactPhone("EXAMPLE-contactPhone-Value")
				.contactType(Contact.ContactType.Primary).build())))
		.referrer("EXAMPLE-referrer-Value").build();

	CreateIncidentRequest createIncidentRequest = CreateIncidentRequest.builder()
		.createIncidentDetails(createIncident)
		.ocid("EXAMPLE-ocid-Value")
		.opcRequestId("UFA4SY2AFFJICPPHLUAW/OpcRequestIdExample/<unique_ID>")
		.homeregion("EXAMPLE-homeregion-Value").build();

        /* Send request to the Client */
        CreateIncidentResponse response = client.createIncident(createIncidentRequest);
    }

    
}