001package com.box.sdk;
002
003import java.util.ArrayList;
004import java.util.List;
005
006import com.eclipsesource.json.JsonArray;
007import com.eclipsesource.json.JsonObject;
008import com.eclipsesource.json.JsonValue;
009
010/**
011 * Represents a conflict that occurs between items that have the same name.
012 */
013public class BoxZipConflict extends BoxJSONObject {
014    private List<BoxZipConflictItem> items;
015
016    /**
017     * Constructs a BoxZipDownloadStatus with default settings.
018     */
019    public BoxZipConflict() {
020    }
021
022    /**
023     * Constructs a BoxZipDownloadStatus from a JSON string.
024     *
025     * @param json the JSON encoded enterprise.
026     */
027    public BoxZipConflict(String json) {
028        super(json);
029    }
030
031    BoxZipConflict(JsonObject jsonObject) {
032        super(jsonObject);
033    }
034
035    /**
036     * Gets the items that conflict because they have the same name.
037     *
038     * @return the items that conflict because they have the same name.
039     */
040    public List<BoxZipConflictItem> getItems() {
041        return this.items;
042    }
043
044    @Override
045    void parseJSONMember(JsonObject.Member member) {
046        JsonArray value = member.getValue().asArray();
047        List<BoxZipConflictItem> conflictItems = new ArrayList<BoxZipConflictItem>(value.size());
048        for (JsonValue item : value) {
049            conflictItems.add(new BoxZipConflictItem(item.asObject()));
050        }
051        this.items = conflictItems;
052    }
053}