All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vendasta.accountgroup.v1.internal.ServiceAvailability Maven / Gradle / Ivy

The newest version!
package com.vendasta.accountgroup.v1.internal;

import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
import java.util.Arrays;
import java.time.Duration;
import org.apache.commons.lang3.StringUtils;
import com.vendasta.accountgroup.v1.generated.ApiProto;

/**
 * 
 **/
public final class ServiceAvailability {




	private final IsAvailable delivery;
	private final IsAvailable noContactDelivery;
	private final IsAvailable inStorePickup;
	private final IsAvailable curbsidePickup;
	private final IsAvailable appointmentsOnly;
	private final IsAvailable ecommerceOnly;
	private final ClosedStatus closedStatus;
	private final Date closedStatusDate;
	

	private ServiceAvailability (
		final IsAvailable delivery,
		final IsAvailable noContactDelivery,
		final IsAvailable inStorePickup,
		final IsAvailable curbsidePickup,
		final IsAvailable appointmentsOnly,
		final IsAvailable ecommerceOnly,
		final ClosedStatus closedStatus,
		final Date closedStatusDate)
		
	{
		this.delivery = delivery;
		this.noContactDelivery = noContactDelivery;
		this.inStorePickup = inStorePickup;
		this.curbsidePickup = curbsidePickup;
		this.appointmentsOnly = appointmentsOnly;
		this.ecommerceOnly = ecommerceOnly;
		this.closedStatus = closedStatus;
		this.closedStatusDate = closedStatusDate;
		
	}
	
	/**
	 * 
      * @return The final value of delivery on the object
	 **/
	public IsAvailable getDelivery() {
		return this.delivery;
	}
	
	/**
	 * 
      * @return The final value of noContactDelivery on the object
	 **/
	public IsAvailable getNoContactDelivery() {
		return this.noContactDelivery;
	}
	
	/**
	 * 
      * @return The final value of inStorePickup on the object
	 **/
	public IsAvailable getInStorePickup() {
		return this.inStorePickup;
	}
	
	/**
	 * 
      * @return The final value of curbsidePickup on the object
	 **/
	public IsAvailable getCurbsidePickup() {
		return this.curbsidePickup;
	}
	
	/**
	 * 
      * @return The final value of appointmentsOnly on the object
	 **/
	public IsAvailable getAppointmentsOnly() {
		return this.appointmentsOnly;
	}
	
	/**
	 * 
      * @return The final value of ecommerceOnly on the object
	 **/
	public IsAvailable getEcommerceOnly() {
		return this.ecommerceOnly;
	}
	
	/**
	 * 
      * @return The final value of closedStatus on the object
	 **/
	public ClosedStatus getClosedStatus() {
		return this.closedStatus;
	}
	
	/**
	 * 
      * @return The final value of closedStatusDate on the object
	 **/
	public Date getClosedStatusDate() {
		return this.closedStatusDate;
	}
	

	public static class Builder {
		private IsAvailable delivery;
		private IsAvailable noContactDelivery;
		private IsAvailable inStorePickup;
		private IsAvailable curbsidePickup;
		private IsAvailable appointmentsOnly;
		private IsAvailable ecommerceOnly;
		private ClosedStatus closedStatus;
		private Date closedStatusDate;
		
		public Builder() {
			this.delivery = null;
			this.noContactDelivery = null;
			this.inStorePickup = null;
			this.curbsidePickup = null;
			this.appointmentsOnly = null;
			this.ecommerceOnly = null;
			this.closedStatus = null;
			this.closedStatusDate = null;
			
		}
		
		/**
		  * Adds a value to the builder for delivery
		  * @param delivery Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setDelivery(IsAvailable delivery) {
			this.delivery = delivery;
			return this;
		}
		
		/**
		  * Adds a value to the builder for noContactDelivery
		  * @param noContactDelivery Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setNoContactDelivery(IsAvailable noContactDelivery) {
			this.noContactDelivery = noContactDelivery;
			return this;
		}
		
		/**
		  * Adds a value to the builder for inStorePickup
		  * @param inStorePickup Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setInStorePickup(IsAvailable inStorePickup) {
			this.inStorePickup = inStorePickup;
			return this;
		}
		
		/**
		  * Adds a value to the builder for curbsidePickup
		  * @param curbsidePickup Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setCurbsidePickup(IsAvailable curbsidePickup) {
			this.curbsidePickup = curbsidePickup;
			return this;
		}
		
		/**
		  * Adds a value to the builder for appointmentsOnly
		  * @param appointmentsOnly Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setAppointmentsOnly(IsAvailable appointmentsOnly) {
			this.appointmentsOnly = appointmentsOnly;
			return this;
		}
		
		/**
		  * Adds a value to the builder for ecommerceOnly
		  * @param ecommerceOnly Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setEcommerceOnly(IsAvailable ecommerceOnly) {
			this.ecommerceOnly = ecommerceOnly;
			return this;
		}
		
		/**
		  * Adds a value to the builder for closedStatus
		  * @param closedStatus Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setClosedStatus(ClosedStatus closedStatus) {
			this.closedStatus = closedStatus;
			return this;
		}
		
		/**
		  * Adds a value to the builder for closedStatusDate
		  * @param closedStatusDate Value to assign to the mutable Builder
		  * @return The Builder instance so that call chaining works
		 **/
		public Builder setClosedStatusDate(Date closedStatusDate) {
			this.closedStatusDate = closedStatusDate;
			return this;
		}
		
		/**
		  * Takes the configuration in the mutable Builder and uses it to instantiate a final instance
		  * of the ServiceAvailability class
		  * @return The instantiated final ServiceAvailability
		 **/
		public ServiceAvailability build() {
			return new ServiceAvailability(
				this.delivery,
				this.noContactDelivery,
				this.inStorePickup,
				this.curbsidePickup,
				this.appointmentsOnly,
				this.ecommerceOnly,
				this.closedStatus,
				this.closedStatusDate);
		}
	}

	/**
	 * Returns a Builder for ServiceAvailability, which is a mutable representation of the object.  Once the
	 * client has built up an object they can then create an immutable ServiceAvailability object using the
	 * build function.
	 * @return A fresh Builder instance with no values set
	 **/
	public static Builder newBuilder() {
		return new Builder();
	}

	/**
	 * Provides a human-readable representation of this object.  Useful for debugging.
	 * @return A string representation of the ServiceAvailability instance
	 **/
	 public String toString() {
		 String result = "ServiceAvailability\n";
		 result += "-> delivery: (IsAvailable)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.delivery).split("\n"))) + "\n"; 
		 result += "-> noContactDelivery: (IsAvailable)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.noContactDelivery).split("\n"))) + "\n"; 
		 result += "-> inStorePickup: (IsAvailable)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.inStorePickup).split("\n"))) + "\n"; 
		 result += "-> curbsidePickup: (IsAvailable)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.curbsidePickup).split("\n"))) + "\n"; 
		 result += "-> appointmentsOnly: (IsAvailable)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.appointmentsOnly).split("\n"))) + "\n"; 
		 result += "-> ecommerceOnly: (IsAvailable)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.ecommerceOnly).split("\n"))) + "\n"; 
		 result += "-> closedStatus: (ClosedStatus)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.closedStatus).split("\n"))) + "\n"; 
		 result += "-> closedStatusDate: (Date)"
		     + StringUtils.join("\n  ", Arrays.asList(String.valueOf(this.closedStatusDate).split("\n"))) + "\n"; 
		 
		 return result;
	 }
	/**
	* Allows for simple conversion between the low-level generated protobuf object to
	* ServiceAvailability, which is much more usable.
	* @return An instance of ServiceAvailability representing the input proto object
	**/
	public static ServiceAvailability fromProto(ApiProto.ServiceAvailability proto) {
		ServiceAvailability out = null;
		if (proto != null) {
			ServiceAvailability.Builder outBuilder = ServiceAvailability.newBuilder()
			.setDelivery(IsAvailable.fromProto(proto.getDelivery()))
			.setNoContactDelivery(IsAvailable.fromProto(proto.getNoContactDelivery()))
			.setInStorePickup(IsAvailable.fromProto(proto.getInStorePickup()))
			.setCurbsidePickup(IsAvailable.fromProto(proto.getCurbsidePickup()))
			.setAppointmentsOnly(IsAvailable.fromProto(proto.getAppointmentsOnly()))
			.setEcommerceOnly(IsAvailable.fromProto(proto.getEcommerceOnly()))
			.setClosedStatus(ClosedStatus.fromProto(proto.getClosedStatus()))
			.setClosedStatusDate(proto.hasClosedStatusDate()?new Date(proto.getClosedStatusDate().getSeconds() * 1000):null);
			out = outBuilder.build();
		}
		return out;
	}

	/**
	* Convenience method for handling lists of proto objects.  It calls .fromProto on each one
	* and returns a list of the converted results.
	* @return A list of ServiceAvailability instances representing the input proto objects
	**/
	public static List fromProtos(List protos) {
		List out = new ArrayList();
		for(ApiProto.ServiceAvailability proto : protos) {
			out.add(ServiceAvailability.fromProto(proto));
		}
		return out;
	}

	/**
	 * Allows for simple conversion of an object to the low-level generated protobuf object.
	 * @return An instance of ApiProto.ServiceAvailability which is a proto object ready for wire transmission
	 **/
	 public ApiProto.ServiceAvailability toProto() {
		 ServiceAvailability obj = this;
		 ApiProto.ServiceAvailability.Builder outBuilder = ApiProto.ServiceAvailability.newBuilder();
		 outBuilder.setDelivery(obj.getDelivery() != null?obj.getDelivery().toProto():null);
		 outBuilder.setNoContactDelivery(obj.getNoContactDelivery() != null?obj.getNoContactDelivery().toProto():null);
		 outBuilder.setInStorePickup(obj.getInStorePickup() != null?obj.getInStorePickup().toProto():null);
		 outBuilder.setCurbsidePickup(obj.getCurbsidePickup() != null?obj.getCurbsidePickup().toProto():null);
		 outBuilder.setAppointmentsOnly(obj.getAppointmentsOnly() != null?obj.getAppointmentsOnly().toProto():null);
		 outBuilder.setEcommerceOnly(obj.getEcommerceOnly() != null?obj.getEcommerceOnly().toProto():null);
		 outBuilder.setClosedStatus(obj.getClosedStatus() != null?obj.getClosedStatus().toProto():null);
		 if(obj.getClosedStatusDate()!=null){outBuilder.setClosedStatusDate(com.google.protobuf.Timestamp.newBuilder().setSeconds(obj.getClosedStatusDate().getTime() / 1000).build());}
		 return outBuilder.build();
	 }

	 /**
	  * Convenience method for handling lists of objects.  It calls .toProto on each one and
	  * returns a list of the converted results.
	  * @return A list of ApiProto.ServiceAvailability instances representing the input objects.
	  */
	public static List toProtos(List objects) {
		List out = new ArrayList();
		if(objects != null) {
			for (ServiceAvailability obj : objects) {
				out.add(obj!=null?obj.toProto():null);
			}
		}
		return out;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy