package com.kbs.kbsintranett;

import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import java.util.List;

public class GravityField {
    @SerializedName("id")
    public String id;

    @SerializedName("type")
    public String type;

    @SerializedName("inputType")
    public String inputType;

    @SerializedName("label")
    public String label;

    @SerializedName("adminLabel")
    public String adminLabel;

    @SerializedName("description")
    public String description;

    @SerializedName("defaultValue")
    public String defaultValue;

    @SerializedName("isRequired")
    public boolean isRequired;

    @SerializedName("checkboxLabel")
    public String checkboxLabel;

    @SerializedName("visibility")
    public String visibility;

    @JsonAdapter(ChoicesAdapter.class)
    @SerializedName("choices")
    public List<Choice> choices;

    @SerializedName("content")
    public String content;

    // --- BRUKER ADAPTEREN HER ---
    @JsonAdapter(InputsAdapter.class)
    @SerializedName("inputs")
    public List<GravityField> inputs;
    // ---------------------------

    @SerializedName("isHidden")
    public boolean isHidden;

    @SerializedName("gwreadonly_enable")
    public boolean readOnly;

    @JsonAdapter(ConditionalLogicAdapter.class)
    @SerializedName("conditionalLogic")
    public ConditionalLogic conditionalLogic;

    @SerializedName("gppa-values-templates")
    public java.util.Map<String, String> gppaTemplates;

    @SerializedName("gpnfForm")
    public String gpnfForm;

    public static class Choice {
        @SerializedName("text") public String text;
        @SerializedName("value") public String value;
    }

    public static class ConditionalLogic {
        @SerializedName("actionType") public String actionType;
        @SerializedName("logicType") public String logicType;
        @SerializedName("rules") public List<Rule> rules;
    }

    public static class Rule {
        @SerializedName("fieldId") public String fieldId;
        @SerializedName("operator") public String operator;
        @SerializedName("value") public String value;
    }
}