// 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).

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.CapacitymanagementService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Capacitymanagement
{
    public class CreateOccCapacityRequestExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var createOccCapacityRequestDetails = new Oci.CapacitymanagementService.Models.CreateOccCapacityRequestDetails
			{
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				OccAvailabilityCatalogId = "ocid1.test.oc1..<unique_ID>EXAMPLE-occAvailabilityCatalogId-Value",
				Namespace = Oci.CapacitymanagementService.Models.Namespace.Compute,
				Region = "EXAMPLE-region-Value",
				DisplayName = "EXAMPLE-displayName-Value",
				RequestType = Oci.CapacitymanagementService.Models.OccCapacityRequest.RequestTypeEnum.Transfer,
				Description = "EXAMPLE-description-Value",
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_xL3Wt", 
						"EXAMPLE_VALUE_qsbwaIHtHZCfTCXBlcLd"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_OBY3y", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_XSzR6", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				LifecycleDetails = "EXAMPLE-lifecycleDetails-Value",
				AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
				DateExpectedCapacityHandover = DateTime.Parse("10/28/2010 16:47:58"),
				RequestState = Oci.CapacitymanagementService.Models.CreateOccCapacityRequestDetails.RequestStateEnum.Submitted,
				Details = new List<Oci.CapacitymanagementService.Models.OccCapacityRequestBaseDetails>
				{
					new Oci.CapacitymanagementService.Models.OccCapacityRequestBaseDetails
					{
						ResourceType = "EXAMPLE-resourceType-Value",
						WorkloadType = "EXAMPLE-workloadType-Value",
						SourceWorkloadType = "EXAMPLE-sourceWorkloadType-Value",
						ExpectedHandoverQuantity = 434,
						DateExpectedHandover = DateTime.Parse("03/22/2001 16:13:30"),
						ActualHandoverQuantity = 45,
						DateActualHandover = DateTime.Parse("12/03/2026 23:28:17"),
						AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
						AssociatedOccHandoverResourceBlockList = new List<Oci.CapacitymanagementService.Models.AssociatedOccHandoverResourceBlock>
						{
							new Oci.CapacitymanagementService.Models.AssociatedOccHandoverResourceBlock
							{
								OccHandoverResourceBlockId = "ocid1.test.oc1..<unique_ID>EXAMPLE-occHandoverResourceBlockId-Value",
								HandoverQuantity = 721
							}
						},
						ResourceName = "EXAMPLE-resourceName-Value",
						DemandQuantity = 85
					}
				}
			};
			var createOccCapacityRequestRequest = new Oci.CapacitymanagementService.Requests.CreateOccCapacityRequestRequest
			{
				CreateOccCapacityRequestDetails = createOccCapacityRequestDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "QRJABQPIWT5UEERDKBPU<unique_ID>"
			};

            // 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. 
            var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
            try
            {
                // Create a service client and send the request.
				using (var client = new CapacityManagementClient(provider, new ClientConfiguration()))
				{
					var response = await client.CreateOccCapacityRequest(createOccCapacityRequestRequest);
					// Retrieve value from the response.
					var hasValueValue = response.RetryAfter.HasValue;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"CreateOccCapacityRequest Failed with {e.Message}");
                throw e;
            }
        }

    }
}