
"""
    This code was generated by Codezu.     

    Changes to this file may cause incorrect behavior and will be lost if
    the code is regenerated.
"""


from mozurestsdk.mozuclient import default as default_client
from mozurestsdk.mozuurl import MozuUrl;
from mozurestsdk.urllocation import UrlLocation
from mozurestsdk.apicontext import ApiContext;

class CustomerPurchaseOrderAccount(object):
	def __init__(self, apiContext: ApiContext = None, mozuClient = None):
		self.client = mozuClient or default_client();
		if (apiContext is not None):
			self.client.withApiContext(apiContext);
		else:
			self.client.withApiContext(ApiContext());
	
	def getCustomerPurchaseOrderAccount(self,accountId, responseFields = None):
		""" Retrieves the details of the specified customer purchase order account.
		
		Args:
			| accountId (int) - Unique identifier of the customer account.
			| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
		
		Returns:
			| CustomerPurchaseOrderAccount 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/customer/accounts/{accountId}/purchaseOrderAccount?responseFields={responseFields}", "GET", UrlLocation.TenantPod, False);
		url.formatUrl("accountId", accountId);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).execute();
		return self.client.result();

	
		
	def getCustomerPurchaseOrderTransactions(self,accountId, startIndex = None, pageSize = None, sortBy = None, filter = None, responseFields = None):
		""" Retrieves a list of purchase order transactions for the specified customer account according to any specified sort options.
		
		Args:
			| accountId (int) - Unique identifier of the customer account.
			| startIndex (int) - When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with pageSize set to 25, to get the 51st through the 75th items, set this parameter to 50.
			| pageSize (int) - When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50.
			| sortBy (string) - The element to sort the results by and the channel in which the results appear. Either ascending (a-z) or descending (z-a) channel. Optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for more information.
			| filter (string) - A set of filter expressions representing the search parameters for a query. This parameter is optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for a list of supported filters.
			| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
		
		Returns:
			| PurchaseOrderTransactionCollection 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/customer/accounts/{accountId}/PurchaseOrderTransaction?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&filter={filter}&responseFields={responseFields}", "GET", UrlLocation.TenantPod, False);
		url.formatUrl("accountId", accountId);
		url.formatUrl("filter", filter);
		url.formatUrl("pageSize", pageSize);
		url.formatUrl("responseFields", responseFields);
		url.formatUrl("sortBy", sortBy);
		url.formatUrl("startIndex", startIndex);
		self.client.withResourceUrl(url).execute();
		return self.client.result();

	
		
	def createCustomerPurchaseOrderAccount(self,customerPurchaseOrderAccount, accountId, responseFields = None):
		""" Adds a purchase order account to the specified customer account.This adds the ability for the specified customer account to use the purchase order payment method.
		
		Args:
			| customerPurchaseOrderAccount(customerPurchaseOrderAccount) - Unique identifier of the customer purchase order account.
			| accountId (int) - Unique identifier of the customer account.
			| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
		
		Returns:
			| CustomerPurchaseOrderAccount 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/customer/accounts/{accountId}/purchaseOrderAccount?responseFields={responseFields}", "POST", UrlLocation.TenantPod, False);
		url.formatUrl("accountId", accountId);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).withBody(customerPurchaseOrderAccount).execute();
		return self.client.result();

	
		
	def createPurchaseOrderTransaction(self,purchaseOrderTransaction, accountId, responseFields = None):
		""" Creates a purchase order transaction on the specified customer purchase order account.
		
		Args:
			| purchaseOrderTransaction(purchaseOrderTransaction) - The purchase order transaction type to add to the specified customer account.
			| accountId (int) - Unique identifier of the customer account.
			| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
		
		Returns:
			| PurchaseOrderTransaction 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/customer/accounts/{accountId}/PurchaseOrderTransaction?responseFields={responseFields}", "POST", UrlLocation.TenantPod, False);
		url.formatUrl("accountId", accountId);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).withBody(purchaseOrderTransaction).execute();
		return self.client.result();

	
		
	def updateCustomerPurchaseOrderAccount(self,customerPurchaseOrderAccount, accountId, responseFields = None):
		""" Updates the details of the purchase order account for the specified customer account.
		
		Args:
			| customerPurchaseOrderAccount(customerPurchaseOrderAccount) - Unique identifier of the customer purchase order account.
			| accountId (int) - Unique identifier of the customer account.
			| responseFields (string) - Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
		
		Returns:
			| CustomerPurchaseOrderAccount 
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/customer/accounts/{accountId}/purchaseOrderAccount?responseFields={responseFields}", "PUT", UrlLocation.TenantPod, False);
		url.formatUrl("accountId", accountId);
		url.formatUrl("responseFields", responseFields);
		self.client.withResourceUrl(url).withBody(customerPurchaseOrderAccount).execute();
		return self.client.result();

	
		
	def deleteCustomerPurchaseOrderAccount(self,accountId):
		""" Deletes the specified customer purchase order account.This removes the ability for the specified customer account to use the purchase order payment method.
		
		Args:
			| accountId (int) - Unique identifier of the customer account.
		
		Raises:
			| ApiException
		
		"""

		url = MozuUrl("/api/commerce/customer/accounts/internal/{accountId}/purchaseOrderAccount", "DELETE", UrlLocation.TenantPod, False);
		url.formatUrl("accountId", accountId);
		self.client.withResourceUrl(url).execute();

	
	
	