|
| 1 | +/* |
| 2 | + * Copyright 2025 Google LLC |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +// Auto-generated code. Do not edit. |
| 18 | + |
| 19 | +package com.google.genai.types; |
| 20 | + |
| 21 | +import com.fasterxml.jackson.annotation.JsonCreator; |
| 22 | +import com.fasterxml.jackson.annotation.JsonValue; |
| 23 | +import com.google.common.base.Ascii; |
| 24 | +import java.util.Objects; |
| 25 | + |
| 26 | +/** The aspect ratio for the image output. */ |
| 27 | +public class AspectRatio { |
| 28 | + |
| 29 | + /** Enum representing the known values for AspectRatio. */ |
| 30 | + public enum Known { |
| 31 | + /** Default value. This value is unused. */ |
| 32 | + ASPECT_RATIO_UNSPECIFIED, |
| 33 | + |
| 34 | + /** 1:1 aspect ratio. */ |
| 35 | + ASPECT_RATIO_ONE_BY_ONE, |
| 36 | + |
| 37 | + /** 2:3 aspect ratio. */ |
| 38 | + ASPECT_RATIO_TWO_BY_THREE, |
| 39 | + |
| 40 | + /** 3:2 aspect ratio. */ |
| 41 | + ASPECT_RATIO_THREE_BY_TWO, |
| 42 | + |
| 43 | + /** 3:4 aspect ratio. */ |
| 44 | + ASPECT_RATIO_THREE_BY_FOUR, |
| 45 | + |
| 46 | + /** 4:3 aspect ratio. */ |
| 47 | + ASPECT_RATIO_FOUR_BY_THREE, |
| 48 | + |
| 49 | + /** 4:5 aspect ratio. */ |
| 50 | + ASPECT_RATIO_FOUR_BY_FIVE, |
| 51 | + |
| 52 | + /** 5:4 aspect ratio. */ |
| 53 | + ASPECT_RATIO_FIVE_BY_FOUR, |
| 54 | + |
| 55 | + /** 9:16 aspect ratio. */ |
| 56 | + ASPECT_RATIO_NINE_BY_SIXTEEN, |
| 57 | + |
| 58 | + /** 16:9 aspect ratio. */ |
| 59 | + ASPECT_RATIO_SIXTEEN_BY_NINE, |
| 60 | + |
| 61 | + /** 21:9 aspect ratio. */ |
| 62 | + ASPECT_RATIO_TWENTY_ONE_BY_NINE, |
| 63 | + |
| 64 | + /** 1:8 aspect ratio. */ |
| 65 | + ASPECT_RATIO_ONE_BY_EIGHT, |
| 66 | + |
| 67 | + /** 8:1 aspect ratio. */ |
| 68 | + ASPECT_RATIO_EIGHT_BY_ONE, |
| 69 | + |
| 70 | + /** 1:4 aspect ratio. */ |
| 71 | + ASPECT_RATIO_ONE_BY_FOUR, |
| 72 | + |
| 73 | + /** 4:1 aspect ratio. */ |
| 74 | + ASPECT_RATIO_FOUR_BY_ONE |
| 75 | + } |
| 76 | + |
| 77 | + private Known aspectRatioEnum; |
| 78 | + private final String value; |
| 79 | + |
| 80 | + @JsonCreator |
| 81 | + public AspectRatio(String value) { |
| 82 | + this.value = value; |
| 83 | + for (Known aspectRatioEnum : Known.values()) { |
| 84 | + if (Ascii.equalsIgnoreCase(aspectRatioEnum.toString(), value)) { |
| 85 | + this.aspectRatioEnum = aspectRatioEnum; |
| 86 | + break; |
| 87 | + } |
| 88 | + } |
| 89 | + if (this.aspectRatioEnum == null) { |
| 90 | + this.aspectRatioEnum = Known.ASPECT_RATIO_UNSPECIFIED; |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + public AspectRatio(Known knownValue) { |
| 95 | + this.aspectRatioEnum = knownValue; |
| 96 | + this.value = knownValue.toString(); |
| 97 | + } |
| 98 | + |
| 99 | + @ExcludeFromGeneratedCoverageReport |
| 100 | + @Override |
| 101 | + @JsonValue |
| 102 | + public String toString() { |
| 103 | + return this.value; |
| 104 | + } |
| 105 | + |
| 106 | + @ExcludeFromGeneratedCoverageReport |
| 107 | + @SuppressWarnings("PatternMatchingInstanceof") |
| 108 | + @Override |
| 109 | + public boolean equals(Object o) { |
| 110 | + if (this == o) { |
| 111 | + return true; |
| 112 | + } |
| 113 | + if (o == null) { |
| 114 | + return false; |
| 115 | + } |
| 116 | + |
| 117 | + if (!(o instanceof AspectRatio)) { |
| 118 | + return false; |
| 119 | + } |
| 120 | + |
| 121 | + AspectRatio other = (AspectRatio) o; |
| 122 | + |
| 123 | + if (this.aspectRatioEnum != Known.ASPECT_RATIO_UNSPECIFIED |
| 124 | + && other.aspectRatioEnum != Known.ASPECT_RATIO_UNSPECIFIED) { |
| 125 | + return this.aspectRatioEnum == other.aspectRatioEnum; |
| 126 | + } else if (this.aspectRatioEnum == Known.ASPECT_RATIO_UNSPECIFIED |
| 127 | + && other.aspectRatioEnum == Known.ASPECT_RATIO_UNSPECIFIED) { |
| 128 | + return this.value.equals(other.value); |
| 129 | + } |
| 130 | + return false; |
| 131 | + } |
| 132 | + |
| 133 | + @ExcludeFromGeneratedCoverageReport |
| 134 | + @Override |
| 135 | + public int hashCode() { |
| 136 | + if (this.aspectRatioEnum != Known.ASPECT_RATIO_UNSPECIFIED) { |
| 137 | + return this.aspectRatioEnum.hashCode(); |
| 138 | + } else { |
| 139 | + return Objects.hashCode(this.value); |
| 140 | + } |
| 141 | + } |
| 142 | + |
| 143 | + @ExcludeFromGeneratedCoverageReport |
| 144 | + public Known knownEnum() { |
| 145 | + return this.aspectRatioEnum; |
| 146 | + } |
| 147 | +} |
0 commit comments