001package com.box.sdkgen.managers.metadatatemplates; 002 003import com.box.sdkgen.internal.NullableFieldTracker; 004import com.box.sdkgen.internal.SerializableObject; 005import com.fasterxml.jackson.annotation.JsonFilter; 006import com.fasterxml.jackson.annotation.JsonProperty; 007import java.util.List; 008import java.util.Objects; 009 010@JsonFilter("nullablePropertyFilter") 011public class CreateMetadataTemplateRequestBody extends SerializableObject { 012 013 /** 014 * The scope of the metadata template to create. Applications can only create templates for use 015 * within the authenticated user's enterprise. 016 * 017 * <p>This value needs to be set to `enterprise`, as `global` scopes can not be created by 018 * applications. 019 */ 020 protected final String scope; 021 022 /** 023 * A unique identifier for the template. This identifier needs to be unique across the enterprise 024 * for which the metadata template is being created. 025 * 026 * <p>When not provided, the API will create a unique `templateKey` based on the value of the 027 * `displayName`. 028 */ 029 protected String templateKey; 030 031 /** The display name of the template. */ 032 protected final String displayName; 033 034 /** 035 * Defines if this template is visible in the Box web app UI, or if it is purely intended for 036 * usage through the API. 037 */ 038 protected Boolean hidden; 039 040 /** 041 * An ordered list of template fields which are part of the template. Each field can be a regular 042 * text field, date field, number field, as well as a single or multi-select list. 043 */ 044 protected List<CreateMetadataTemplateRequestBodyFieldsField> fields; 045 046 /** 047 * Whether or not to copy any metadata attached to a file or folder when it is copied. By default, 048 * metadata is not copied along with a file or folder when it is copied. 049 */ 050 protected Boolean copyInstanceOnItemCopy; 051 052 public CreateMetadataTemplateRequestBody( 053 @JsonProperty("scope") String scope, @JsonProperty("displayName") String displayName) { 054 super(); 055 this.scope = scope; 056 this.displayName = displayName; 057 } 058 059 protected CreateMetadataTemplateRequestBody(Builder builder) { 060 super(); 061 this.scope = builder.scope; 062 this.templateKey = builder.templateKey; 063 this.displayName = builder.displayName; 064 this.hidden = builder.hidden; 065 this.fields = builder.fields; 066 this.copyInstanceOnItemCopy = builder.copyInstanceOnItemCopy; 067 markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); 068 } 069 070 public String getScope() { 071 return scope; 072 } 073 074 public String getTemplateKey() { 075 return templateKey; 076 } 077 078 public String getDisplayName() { 079 return displayName; 080 } 081 082 public Boolean getHidden() { 083 return hidden; 084 } 085 086 public List<CreateMetadataTemplateRequestBodyFieldsField> getFields() { 087 return fields; 088 } 089 090 public Boolean getCopyInstanceOnItemCopy() { 091 return copyInstanceOnItemCopy; 092 } 093 094 @Override 095 public boolean equals(Object o) { 096 if (this == o) { 097 return true; 098 } 099 if (o == null || getClass() != o.getClass()) { 100 return false; 101 } 102 CreateMetadataTemplateRequestBody casted = (CreateMetadataTemplateRequestBody) o; 103 return Objects.equals(scope, casted.scope) 104 && Objects.equals(templateKey, casted.templateKey) 105 && Objects.equals(displayName, casted.displayName) 106 && Objects.equals(hidden, casted.hidden) 107 && Objects.equals(fields, casted.fields) 108 && Objects.equals(copyInstanceOnItemCopy, casted.copyInstanceOnItemCopy); 109 } 110 111 @Override 112 public int hashCode() { 113 return Objects.hash(scope, templateKey, displayName, hidden, fields, copyInstanceOnItemCopy); 114 } 115 116 @Override 117 public String toString() { 118 return "CreateMetadataTemplateRequestBody{" 119 + "scope='" 120 + scope 121 + '\'' 122 + ", " 123 + "templateKey='" 124 + templateKey 125 + '\'' 126 + ", " 127 + "displayName='" 128 + displayName 129 + '\'' 130 + ", " 131 + "hidden='" 132 + hidden 133 + '\'' 134 + ", " 135 + "fields='" 136 + fields 137 + '\'' 138 + ", " 139 + "copyInstanceOnItemCopy='" 140 + copyInstanceOnItemCopy 141 + '\'' 142 + "}"; 143 } 144 145 public static class Builder extends NullableFieldTracker { 146 147 protected final String scope; 148 149 protected String templateKey; 150 151 protected final String displayName; 152 153 protected Boolean hidden; 154 155 protected List<CreateMetadataTemplateRequestBodyFieldsField> fields; 156 157 protected Boolean copyInstanceOnItemCopy; 158 159 public Builder(String scope, String displayName) { 160 super(); 161 this.scope = scope; 162 this.displayName = displayName; 163 } 164 165 public Builder templateKey(String templateKey) { 166 this.templateKey = templateKey; 167 return this; 168 } 169 170 public Builder hidden(Boolean hidden) { 171 this.hidden = hidden; 172 return this; 173 } 174 175 public Builder fields(List<CreateMetadataTemplateRequestBodyFieldsField> fields) { 176 this.fields = fields; 177 return this; 178 } 179 180 public Builder copyInstanceOnItemCopy(Boolean copyInstanceOnItemCopy) { 181 this.copyInstanceOnItemCopy = copyInstanceOnItemCopy; 182 return this; 183 } 184 185 public CreateMetadataTemplateRequestBody build() { 186 return new CreateMetadataTemplateRequestBody(this); 187 } 188 } 189}