001package com.box.sdkgen.managers.termsofservices; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.box.sdkgen.serialization.json.EnumWrapper; 006import com.fasterxml.jackson.annotation.JsonFilter; 007import com.fasterxml.jackson.annotation.JsonProperty; 008import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 009import com.fasterxml.jackson.databind.annotation.JsonSerialize; 010import java.util.Objects; 011 012@JsonFilter("nullablePropertyFilter") 013public class CreateTermsOfServiceRequestBody extends SerializableObject { 014 015 /** Whether this terms of service is active. */ 016 @JsonDeserialize( 017 using = 018 CreateTermsOfServiceRequestBodyStatusField 019 .CreateTermsOfServiceRequestBodyStatusFieldDeserializer.class) 020 @JsonSerialize( 021 using = 022 CreateTermsOfServiceRequestBodyStatusField 023 .CreateTermsOfServiceRequestBodyStatusFieldSerializer.class) 024 protected final EnumWrapper<CreateTermsOfServiceRequestBodyStatusField> status; 025 026 /** The type of user to set the terms of service for. */ 027 @JsonDeserialize( 028 using = 029 CreateTermsOfServiceRequestBodyTosTypeField 030 .CreateTermsOfServiceRequestBodyTosTypeFieldDeserializer.class) 031 @JsonSerialize( 032 using = 033 CreateTermsOfServiceRequestBodyTosTypeField 034 .CreateTermsOfServiceRequestBodyTosTypeFieldSerializer.class) 035 @JsonProperty("tos_type") 036 protected EnumWrapper<CreateTermsOfServiceRequestBodyTosTypeField> tosType; 037 038 /** 039 * The terms of service text to display to users. 040 * 041 * <p>The text can be set to empty if the `status` is set to `disabled`. 042 */ 043 protected final String text; 044 045 public CreateTermsOfServiceRequestBody( 046 CreateTermsOfServiceRequestBodyStatusField status, String text) { 047 super(); 048 this.status = new EnumWrapper<CreateTermsOfServiceRequestBodyStatusField>(status); 049 this.text = text; 050 } 051 052 public CreateTermsOfServiceRequestBody( 053 @JsonProperty("status") EnumWrapper<CreateTermsOfServiceRequestBodyStatusField> status, 054 @JsonProperty("text") String text) { 055 super(); 056 this.status = status; 057 this.text = text; 058 } 059 060 protected CreateTermsOfServiceRequestBody(Builder builder) { 061 super(); 062 this.status = builder.status; 063 this.tosType = builder.tosType; 064 this.text = builder.text; 065 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 066 } 067 068 public EnumWrapper<CreateTermsOfServiceRequestBodyStatusField> getStatus() { 069 return status; 070 } 071 072 public EnumWrapper<CreateTermsOfServiceRequestBodyTosTypeField> getTosType() { 073 return tosType; 074 } 075 076 public String getText() { 077 return text; 078 } 079 080 @Override 081 public boolean equals(Object o) { 082 if (this == o) { 083 return true; 084 } 085 if (o == null || getClass() != o.getClass()) { 086 return false; 087 } 088 CreateTermsOfServiceRequestBody casted = (CreateTermsOfServiceRequestBody) o; 089 return Objects.equals(status, casted.status) 090 && Objects.equals(tosType, casted.tosType) 091 && Objects.equals(text, casted.text); 092 } 093 094 @Override 095 public int hashCode() { 096 return Objects.hash(status, tosType, text); 097 } 098 099 @Override 100 public String toString() { 101 return "CreateTermsOfServiceRequestBody{" 102 + "status='" 103 + status 104 + '\'' 105 + ", " 106 + "tosType='" 107 + tosType 108 + '\'' 109 + ", " 110 + "text='" 111 + text 112 + '\'' 113 + "}"; 114 } 115 116 public static class Builder extends NullableFieldTracker { 117 118 protected final EnumWrapper<CreateTermsOfServiceRequestBodyStatusField> status; 119 120 protected EnumWrapper<CreateTermsOfServiceRequestBodyTosTypeField> tosType; 121 122 protected final String text; 123 124 public Builder(CreateTermsOfServiceRequestBodyStatusField status, String text) { 125 super(); 126 this.status = new EnumWrapper<CreateTermsOfServiceRequestBodyStatusField>(status); 127 this.text = text; 128 } 129 130 public Builder(EnumWrapper<CreateTermsOfServiceRequestBodyStatusField> status, String text) { 131 super(); 132 this.status = status; 133 this.text = text; 134 } 135 136 public Builder tosType(CreateTermsOfServiceRequestBodyTosTypeField tosType) { 137 this.tosType = new EnumWrapper<CreateTermsOfServiceRequestBodyTosTypeField>(tosType); 138 return this; 139 } 140 141 public Builder tosType(EnumWrapper<CreateTermsOfServiceRequestBodyTosTypeField> tosType) { 142 this.tosType = tosType; 143 return this; 144 } 145 146 public CreateTermsOfServiceRequestBody build() { 147 return new CreateTermsOfServiceRequestBody(this); 148 } 149 } 150}