// 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.OspgatewayService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Ospgateway
{
    public class UpdateSubscriptionExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateSubscriptionDetails = new Oci.OspgatewayService.Models.UpdateSubscriptionDetails
			{
				Subscription = new Oci.OspgatewayService.Models.Subscription
				{
					Id = "ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
					SubscriptionPlanNumber = "EXAMPLE-subscriptionPlanNumber-Value",
					PlanType = Oci.OspgatewayService.Models.Subscription.PlanTypeEnum.FreeTier,
					TimeStart = DateTime.Parse("02/16/2047 01:29:02"),
					ShipToCustAcctSiteId = "ocid1.test.oc1..<unique_ID>EXAMPLE-shipToCustAcctSiteId-Value",
					ShipToCustAcctRoleId = "ocid1.test.oc1..<unique_ID>EXAMPLE-shipToCustAcctRoleId-Value",
					BillToCustAccountId = "ocid1.test.oc1..<unique_ID>EXAMPLE-billToCustAccountId-Value",
					IsIntentToPay = true,
					IsCorporateConversionAllowed = false,
					CurrencyCode = "EXAMPLE-currencyCode-Value",
					GsiOrgCode = "EXAMPLE-gsiOrgCode-Value",
					LanguageCode = "EXAMPLE-languageCode-Value",
					OrganizationId = "ocid1.test.oc1..<unique_ID>EXAMPLE-organizationId-Value",
					UpgradeState = Oci.OspgatewayService.Models.Subscription.UpgradeStateEnum.Error,
					UpgradeStateDetails = Oci.OspgatewayService.Models.Subscription.UpgradeStateDetailsEnum.TaxError,
					AccountType = Oci.OspgatewayService.Models.Subscription.AccountTypeEnum.CorporateSubmitted,
					TaxInfo = new Oci.OspgatewayService.Models.TaxInfo
					{
						TaxPayerId = "ocid1.test.oc1..<unique_ID>EXAMPLE-taxPayerId-Value",
						TaxRegNumber = "EXAMPLE-taxRegNumber-Value",
						NoTaxReasonCode = "EXAMPLE-noTaxReasonCode-Value",
						NoTaxReasonCodeDetails = "EXAMPLE-noTaxReasonCodeDetails-Value",
						TaxCnpj = "EXAMPLE-taxCnpj-Value",
						Giro = "EXAMPLE-giro-Value"
					},
					PaymentOptions = new List<Oci.OspgatewayService.Models.PaymentOption>
					{
						new Oci.OspgatewayService.Models.PaypalPaymentOption
						{
							EmailAddress = "EXAMPLE-emailAddress-Value",
							FirstName = "EXAMPLE-firstName-Value",
							LastName = "EXAMPLE-lastName-Value",
							ExtBillingAgreementId = "ocid1.test.oc1..<unique_ID>EXAMPLE-extBillingAgreementId-Value",
							WalletInstrumentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-walletInstrumentId-Value",
							WalletTransactionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-walletTransactionId-Value"
						}
					},
					PaymentGateway = new Oci.OspgatewayService.Models.PaymentGateway
					{
						MerchantDefinedData = new Oci.OspgatewayService.Models.MerchantDefinedData
						{
							PromoType = "EXAMPLE-promoType-Value",
							CloudAccountName = "EXAMPLE-cloudAccountName-Value"
						}
					},
					BillingAddress = new Oci.OspgatewayService.Models.Address
					{
						AddressKey = "EXAMPLE-addressKey-Value",
						Line1 = "EXAMPLE-line1-Value",
						Line2 = "EXAMPLE-line2-Value",
						Line3 = "EXAMPLE-line3-Value",
						Line4 = "EXAMPLE-line4-Value",
						StreetName = "EXAMPLE-streetName-Value",
						StreetNumber = "EXAMPLE-streetNumber-Value",
						City = "EXAMPLE-city-Value",
						County = "EXAMPLE-county-Value",
						Country = "EXAMPLE-country-Value",
						Province = "EXAMPLE-province-Value",
						PostalCode = "EXAMPLE-postalCode-Value",
						State = "EXAMPLE-state-Value",
						EmailAddress = "EXAMPLE-emailAddress-Value",
						CompanyName = "EXAMPLE-companyName-Value",
						FirstName = "EXAMPLE-firstName-Value",
						MiddleName = "EXAMPLE-middleName-Value",
						LastName = "EXAMPLE-lastName-Value",
						PhoneCountryCode = "EXAMPLE-phoneCountryCode-Value",
						PhoneNumber = "EXAMPLE-phoneNumber-Value",
						JobTitle = "EXAMPLE-jobTitle-Value",
						DepartmentName = "EXAMPLE-departmentName-Value",
						InternalNumber = "EXAMPLE-internalNumber-Value",
						ContributorClass = "EXAMPLE-contributorClass-Value",
						StateInscription = "EXAMPLE-stateInscription-Value",
						MunicipalInscription = "EXAMPLE-municipalInscription-Value"
					},
					TimePlanUpgrade = DateTime.Parse("01/21/2046 09:51:58"),
					TimePersonalToCorporateConv = DateTime.Parse("12/19/2022 00:49:49")
				},
				Email = "EXAMPLE-email-Value"
			};
			var updateSubscriptionRequest = new Oci.OspgatewayService.Requests.UpdateSubscriptionRequest
			{
				SubscriptionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subscriptionId-Value",
				OspHomeRegion = "EXAMPLE-ospHomeRegion-Value",
				CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
				UpdateSubscriptionDetails = updateSubscriptionDetails,
				OpcRequestId = "T3UOEICIKFH5TY4THWDE<unique_ID>",
				IfMatch = "EXAMPLE-ifMatch-Value"
			};

            // 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 SubscriptionServiceClient(provider, new ClientConfiguration()))
				{
					var response = await client.UpdateSubscription(updateSubscriptionRequest);
					// Retrieve value from the response.
					var id = response.Subscription.Id;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateSubscription Failed with {e.Message}");
                throw e;
            }
        }

    }
}