// 
// Decompiled by Procyon v0.6.0
// 

package io.sentry.protocol;

import java.util.HashMap;
import io.sentry.vendor.gson.stream.JsonToken;
import io.sentry.ObjectReader;
import io.sentry.JsonDeserializer;
import java.io.IOException;
import java.util.Iterator;
import io.sentry.ILogger;
import org.jetbrains.annotations.NotNull;
import io.sentry.ObjectWriter;
import java.util.Map;
import java.util.List;
import org.jetbrains.annotations.Nullable;
import io.sentry.JsonSerializable;
import io.sentry.JsonUnknown;

public final class ViewHierarchyNode implements JsonUnknown, JsonSerializable
{
    @Nullable
    private String renderingSystem;
    @Nullable
    private String type;
    @Nullable
    private String identifier;
    @Nullable
    private String tag;
    @Nullable
    private Double width;
    @Nullable
    private Double height;
    @Nullable
    private Double x;
    @Nullable
    private Double y;
    @Nullable
    private String visibility;
    @Nullable
    private Double alpha;
    @Nullable
    private List<ViewHierarchyNode> children;
    @Nullable
    private Map<String, Object> unknown;
    
    public void setRenderingSystem(final String renderingSystem) {
        this.renderingSystem = renderingSystem;
    }
    
    public void setType(final String type) {
        this.type = type;
    }
    
    public void setIdentifier(@Nullable final String identifier) {
        this.identifier = identifier;
    }
    
    public void setTag(@Nullable final String tag) {
        this.tag = tag;
    }
    
    public void setWidth(@Nullable final Double width) {
        this.width = width;
    }
    
    public void setHeight(@Nullable final Double height) {
        this.height = height;
    }
    
    public void setX(@Nullable final Double x) {
        this.x = x;
    }
    
    public void setY(@Nullable final Double y) {
        this.y = y;
    }
    
    public void setVisibility(@Nullable final String visibility) {
        this.visibility = visibility;
    }
    
    public void setAlpha(@Nullable final Double alpha) {
        this.alpha = alpha;
    }
    
    public void setChildren(@Nullable final List<ViewHierarchyNode> children) {
        this.children = children;
    }
    
    @Nullable
    public String getRenderingSystem() {
        return this.renderingSystem;
    }
    
    @Nullable
    public String getType() {
        return this.type;
    }
    
    @Nullable
    public String getIdentifier() {
        return this.identifier;
    }
    
    @Nullable
    public String getTag() {
        return this.tag;
    }
    
    @Nullable
    public Double getWidth() {
        return this.width;
    }
    
    @Nullable
    public Double getHeight() {
        return this.height;
    }
    
    @Nullable
    public Double getX() {
        return this.x;
    }
    
    @Nullable
    public Double getY() {
        return this.y;
    }
    
    @Nullable
    public String getVisibility() {
        return this.visibility;
    }
    
    @Nullable
    public Double getAlpha() {
        return this.alpha;
    }
    
    @Nullable
    public List<ViewHierarchyNode> getChildren() {
        return this.children;
    }
    
    @Override
    public void serialize(@NotNull final ObjectWriter writer, @NotNull final ILogger logger) throws IOException {
        writer.beginObject();
        if (this.renderingSystem != null) {
            writer.name("rendering_system").value(this.renderingSystem);
        }
        if (this.type != null) {
            writer.name("type").value(this.type);
        }
        if (this.identifier != null) {
            writer.name("identifier").value(this.identifier);
        }
        if (this.tag != null) {
            writer.name("tag").value(this.tag);
        }
        if (this.width != null) {
            writer.name("width").value(this.width);
        }
        if (this.height != null) {
            writer.name("height").value(this.height);
        }
        if (this.x != null) {
            writer.name("x").value(this.x);
        }
        if (this.y != null) {
            writer.name("y").value(this.y);
        }
        if (this.visibility != null) {
            writer.name("visibility").value(this.visibility);
        }
        if (this.alpha != null) {
            writer.name("alpha").value(this.alpha);
        }
        if (this.children != null && !this.children.isEmpty()) {
            writer.name("children").value(logger, this.children);
        }
        if (this.unknown != null) {
            for (final String key : this.unknown.keySet()) {
                final Object value = this.unknown.get(key);
                writer.name(key).value(logger, value);
            }
        }
        writer.endObject();
    }
    
    @Nullable
    @Override
    public Map<String, Object> getUnknown() {
        return this.unknown;
    }
    
    @Override
    public void setUnknown(@Nullable final Map<String, Object> unknown) {
        this.unknown = unknown;
    }
    
    public static final class JsonKeys
    {
        public static final String RENDERING_SYSTEM = "rendering_system";
        public static final String TYPE = "type";
        public static final String IDENTIFIER = "identifier";
        public static final String TAG = "tag";
        public static final String WIDTH = "width";
        public static final String HEIGHT = "height";
        public static final String X = "x";
        public static final String Y = "y";
        public static final String VISIBILITY = "visibility";
        public static final String ALPHA = "alpha";
        public static final String CHILDREN = "children";
    }
    
    public static final class Deserializer implements JsonDeserializer<ViewHierarchyNode>
    {
        @NotNull
        @Override
        public ViewHierarchyNode deserialize(@NotNull final ObjectReader reader, @NotNull final ILogger logger) throws Exception {
            Map<String, Object> unknown = null;
            final ViewHierarchyNode node = new ViewHierarchyNode();
            reader.beginObject();
            while (reader.peek() == JsonToken.NAME) {
                final String nextName2;
                final String nextName = nextName2 = reader.nextName();
                switch (nextName2) {
                    case "rendering_system": {
                        node.renderingSystem = reader.nextStringOrNull();
                        continue;
                    }
                    case "type": {
                        node.type = reader.nextStringOrNull();
                        continue;
                    }
                    case "identifier": {
                        node.identifier = reader.nextStringOrNull();
                        continue;
                    }
                    case "tag": {
                        node.tag = reader.nextStringOrNull();
                        continue;
                    }
                    case "width": {
                        node.width = reader.nextDoubleOrNull();
                        continue;
                    }
                    case "height": {
                        node.height = reader.nextDoubleOrNull();
                        continue;
                    }
                    case "x": {
                        node.x = reader.nextDoubleOrNull();
                        continue;
                    }
                    case "y": {
                        node.y = reader.nextDoubleOrNull();
                        continue;
                    }
                    case "visibility": {
                        node.visibility = reader.nextStringOrNull();
                        continue;
                    }
                    case "alpha": {
                        node.alpha = reader.nextDoubleOrNull();
                        continue;
                    }
                    case "children": {
                        node.children = (List<ViewHierarchyNode>)reader.nextListOrNull(logger, (JsonDeserializer<Object>)this);
                        continue;
                    }
                    default: {
                        if (unknown == null) {
                            unknown = new HashMap<String, Object>();
                        }
                        reader.nextUnknown(logger, unknown, nextName);
                        continue;
                    }
                }
            }
            reader.endObject();
            node.setUnknown(unknown);
            return node;
        }
    }
}
