
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by Codezu.     
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using Mozu.Api.Security;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using System.Threading;

namespace Mozu.Api.Resources.Commerce.Shipping.Admin.Profiles
{
	/// <summary>
	/// Use the ShippingStates sub-resource to manage the states your shipping profile supports. For example, you can specify one of your shipping profiles to only support Texas, Oklahoma, Arkansas, Louisiana, and New Mexico.Each shipping state is composed of a user-definied code and name.
	/// </summary>
	public partial class ShippingStatesResource  	{
		///
		/// <see cref="Mozu.Api.ApiContext"/>
		///
		private readonly IApiContext _apiContext;

		
		public ShippingStatesResource(IApiContext apiContext) 
		{
			_apiContext = apiContext;
		}

		public ShippingStatesResource CloneWithApiContext(Action<IApiContext> contextModification) 
		{
			return new ShippingStatesResource(_apiContext.CloneWith(contextModification));
		}

				

		/// <summary>
		/// 
		/// </summary>
		/// <param name="profileCode">The unique, user-defined code of the profile with which the shipping state is associated.</param>
		/// <param name="dataViewMode">{<see cref="Mozu.Api.DataViewMode"/>}</param>
		/// <returns>
		/// List{<see cref="Mozu.Api.Contracts.ShippingAdmin.Profile.ShippingStates"/>}
		/// </returns>
		/// <example>
		/// <code>
		///   var shippingstates = new ShippingStates();
		///   var shippingStates = await shippingstates.GetStatesAsync( profileCode);
		/// </code>
		/// </example>
		public virtual async Task<List<Mozu.Api.Contracts.ShippingAdmin.Profile.ShippingStates>> GetStatesAsync(string profileCode, CancellationToken ct = default(CancellationToken))
		{
			MozuClient<List<Mozu.Api.Contracts.ShippingAdmin.Profile.ShippingStates>> response;
			var client = Mozu.Api.Clients.Commerce.Shipping.Admin.Profiles.ShippingStatesClient.GetStatesClient( profileCode);
			client.WithContext(_apiContext);
			response = await client.ExecuteAsync(ct).ConfigureAwait(false);
			return await response.ResultAsync();

		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="profilecode">The unique, user-defined code of the profile with which the shipping state is associated.</param>
		/// <param name="dataViewMode">{<see cref="Mozu.Api.DataViewMode"/>}</param>
		/// <param name="states">The updated details of the shipping states associated with the specified profilecode.</param>
		/// <returns>
		/// List{<see cref="Mozu.Api.Contracts.ShippingAdmin.Profile.ShippingStates"/>}
		/// </returns>
		/// <example>
		/// <code>
		///   var shippingstates = new ShippingStates();
		///   var shippingStates = await shippingstates.UpdateStatesAsync( states,  profilecode);
		/// </code>
		/// </example>
		public virtual async Task<List<Mozu.Api.Contracts.ShippingAdmin.Profile.ShippingStates>> UpdateStatesAsync(List<Mozu.Api.Contracts.ShippingAdmin.Profile.ShippingStates> states, string profilecode, CancellationToken ct = default(CancellationToken))
		{
			MozuClient<List<Mozu.Api.Contracts.ShippingAdmin.Profile.ShippingStates>> response;
			var client = Mozu.Api.Clients.Commerce.Shipping.Admin.Profiles.ShippingStatesClient.UpdateStatesClient( states,  profilecode);
			client.WithContext(_apiContext);
			response = await client.ExecuteAsync(ct).ConfigureAwait(false);
			return await response.ResultAsync();

		}


	}

}


