001// Generated by delombok at Thu Aug 13 13:56:43 UTC 2026
002/*
003 * Copyright (c) 2010-2026 Mark Allen, Norbert Bartels.
004 *
005 * Permission is hereby granted, free of charge, to any person obtaining a copy
006 * of this software and associated documentation files (the "Software"), to deal
007 * in the Software without restriction, including without limitation the rights
008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
009 * copies of the Software, and to permit persons to whom the Software is
010 * furnished to do so, subject to the following conditions:
011 *
012 * The above copyright notice and this permission notice shall be included in
013 * all copies or substantial portions of the Software.
014 *
015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
021 * THE SOFTWARE.
022 */
023package com.restfb.types.ads;
024
025import com.restfb.Facebook;
026import com.restfb.JsonMapper;
027import com.restfb.json.Json;
028import com.restfb.json.JsonArray;
029import com.restfb.json.JsonValue;
030import com.restfb.types.AbstractFacebookType;
031
032/**
033 * Represents the
034 * <a href="https://developers.facebook.com/docs/marketing-api/reference/ads-image-crops/">AdsImageCrops</a> Marketing
035 * API type
036 *
037 * Every field is following the crops specification, in the format of [[{left},{top}],[{right},{bottom}]].
038 */
039public class AdsImageCrops extends AbstractFacebookType {
040  private AdsImageCropsSpec thumb100x100;
041  @Facebook("100x100")
042  private String thumb100x100String;
043  private AdsImageCropsSpec thumb100x72;
044  @Facebook("100x72")
045  private String thumb100x72String;
046  private AdsImageCropsSpec thumb191x100;
047  @Facebook("191x100")
048  private String thumb191x100String;
049  private AdsImageCropsSpec thumb400x150;
050  @Facebook("400x150")
051  private String thumb400x150String;
052  private AdsImageCropsSpec thumb600x360;
053  @Facebook("600x360")
054  private String thumb600x360String;
055
056
057  public static class AdsImageCropsSpec extends AbstractFacebookType {
058    private Long left;
059    private Long top;
060    private Long right;
061    private Long bottom;
062
063    @java.lang.SuppressWarnings("all")
064    @lombok.Generated
065    public Long getLeft() {
066      return this.left;
067    }
068
069    @java.lang.SuppressWarnings("all")
070    @lombok.Generated
071    public void setLeft(final Long left) {
072      this.left = left;
073    }
074
075    @java.lang.SuppressWarnings("all")
076    @lombok.Generated
077    public Long getTop() {
078      return this.top;
079    }
080
081    @java.lang.SuppressWarnings("all")
082    @lombok.Generated
083    public void setTop(final Long top) {
084      this.top = top;
085    }
086
087    @java.lang.SuppressWarnings("all")
088    @lombok.Generated
089    public Long getRight() {
090      return this.right;
091    }
092
093    @java.lang.SuppressWarnings("all")
094    @lombok.Generated
095    public void setRight(final Long right) {
096      this.right = right;
097    }
098
099    @java.lang.SuppressWarnings("all")
100    @lombok.Generated
101    public Long getBottom() {
102      return this.bottom;
103    }
104
105    @java.lang.SuppressWarnings("all")
106    @lombok.Generated
107    public void setBottom(final Long bottom) {
108      this.bottom = bottom;
109    }
110  }
111
112  @JsonMapper.JsonMappingCompleted
113  private void convert() {
114    thumb100x100 = createSpecFromString(thumb100x100String);
115    thumb100x72 = createSpecFromString(thumb100x72String);
116    thumb191x100 = createSpecFromString(thumb191x100String);
117    thumb400x150 = createSpecFromString(thumb400x150String);
118    thumb600x360 = createSpecFromString(thumb600x360String);
119  }
120
121  private AdsImageCropsSpec createSpecFromString(String input) {
122    AdsImageCropsSpec spec = null;
123    if (input != null) {
124      spec = new AdsImageCropsSpec();
125      JsonValue ar = Json.parse(input);
126      JsonArray outerArray = ar.asArray();
127      JsonArray leftTop = outerArray.get(0).asArray();
128      spec.setLeft(leftTop.get(0).asLong());
129      spec.setTop(leftTop.get(1).asLong());
130      JsonArray rightBottom = outerArray.get(1).asArray();
131      spec.setRight(rightBottom.get(0).asLong());
132      spec.setBottom(rightBottom.get(1).asLong());
133    }
134    return spec;
135  }
136
137  @java.lang.SuppressWarnings("all")
138  @lombok.Generated
139  public AdsImageCropsSpec getThumb100x100() {
140    return this.thumb100x100;
141  }
142
143  @java.lang.SuppressWarnings("all")
144  @lombok.Generated
145  public void setThumb100x100(final AdsImageCropsSpec thumb100x100) {
146    this.thumb100x100 = thumb100x100;
147  }
148
149  @java.lang.SuppressWarnings("all")
150  @lombok.Generated
151  public AdsImageCropsSpec getThumb100x72() {
152    return this.thumb100x72;
153  }
154
155  @java.lang.SuppressWarnings("all")
156  @lombok.Generated
157  public void setThumb100x72(final AdsImageCropsSpec thumb100x72) {
158    this.thumb100x72 = thumb100x72;
159  }
160
161  @java.lang.SuppressWarnings("all")
162  @lombok.Generated
163  public AdsImageCropsSpec getThumb191x100() {
164    return this.thumb191x100;
165  }
166
167  @java.lang.SuppressWarnings("all")
168  @lombok.Generated
169  public void setThumb191x100(final AdsImageCropsSpec thumb191x100) {
170    this.thumb191x100 = thumb191x100;
171  }
172
173  @java.lang.SuppressWarnings("all")
174  @lombok.Generated
175  public AdsImageCropsSpec getThumb400x150() {
176    return this.thumb400x150;
177  }
178
179  @java.lang.SuppressWarnings("all")
180  @lombok.Generated
181  public void setThumb400x150(final AdsImageCropsSpec thumb400x150) {
182    this.thumb400x150 = thumb400x150;
183  }
184
185  @java.lang.SuppressWarnings("all")
186  @lombok.Generated
187  public AdsImageCropsSpec getThumb600x360() {
188    return this.thumb600x360;
189  }
190
191  @java.lang.SuppressWarnings("all")
192  @lombok.Generated
193  public void setThumb600x360(final AdsImageCropsSpec thumb600x360) {
194    this.thumb600x360 = thumb600x360;
195  }
196}