/*
 * Smart GWT (GWT for SmartClient)
 * Copyright 2008 and beyond, Isomorphic Software, Inc.
 *
 * Smart GWT is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 3
 * as published by the Free Software Foundation.  Smart GWT is also
 * available under typical commercial license terms - see
 * http://smartclient.com/license
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 */
/* sgwtgen */
 
package com.smartgwt.client.data;


import com.smartgwt.client.event.*;
import com.smartgwt.client.core.*;
import com.smartgwt.client.types.*;
import com.smartgwt.client.data.*;
import com.smartgwt.client.data.Record;
import com.smartgwt.client.data.events.*;
import com.smartgwt.client.browser.window.*;
import com.smartgwt.client.rpc.*;
import com.smartgwt.client.ai.*;
import com.smartgwt.client.callbacks.*;
import com.smartgwt.client.tools.*;
import com.smartgwt.client.bean.*;
import com.smartgwt.client.widgets.*;
import com.smartgwt.client.widgets.ai.*;
import com.smartgwt.client.widgets.events.*;
import com.smartgwt.client.widgets.form.*;
import com.smartgwt.client.widgets.form.validator.*;
import com.smartgwt.client.widgets.form.fields.*;
import com.smartgwt.client.widgets.tile.*;
import com.smartgwt.client.widgets.tile.events.*;
import com.smartgwt.client.widgets.grid.*;
import com.smartgwt.client.widgets.grid.events.*;
import com.smartgwt.client.widgets.chart.*;
import com.smartgwt.client.widgets.layout.*;
import com.smartgwt.client.widgets.layout.events.*;
import com.smartgwt.client.widgets.menu.*;
import com.smartgwt.client.widgets.tour.*;
import com.smartgwt.client.widgets.notify.*;
import com.smartgwt.client.widgets.rte.*;
import com.smartgwt.client.widgets.rte.events.*;
import com.smartgwt.client.widgets.ace.*;
import com.smartgwt.client.widgets.ace.events.*;
import com.smartgwt.client.widgets.tab.*;
import com.smartgwt.client.widgets.toolbar.*;
import com.smartgwt.client.widgets.tree.*;
import com.smartgwt.client.widgets.tree.events.*;
import com.smartgwt.client.widgets.tableview.*;
import com.smartgwt.client.widgets.viewer.*;
import com.smartgwt.client.widgets.calendar.*;
import com.smartgwt.client.widgets.calendar.events.*;
import com.smartgwt.client.widgets.cube.*;
import com.smartgwt.client.widgets.notify.*;
import com.smartgwt.client.widgets.drawing.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.google.gwt.event.shared.*;
import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.core.client.JavaScriptObject;

import com.smartgwt.client.util.*;
import com.smartgwt.client.util.events.*;
import com.smartgwt.client.util.workflow.*;
import com.smartgwt.client.util.workflow.Process; // required to override java.lang.Process
import com.smartgwt.client.util.tour.*;


/**
 * Settings for {@link com.smartgwt.client.data.DataSource#asJSONSchema DataSource.asJSONSchema()}, controlling what
 * information is included and how it is formatted.
 */
@BeanFactory.FrameworkClass
public class JSONSchemaSettings extends DataClass {

    public static JSONSchemaSettings getOrCreateRef(JavaScriptObject jsObj) {
        if(jsObj == null) return null;
        return new JSONSchemaSettings(jsObj);
    }
        


    public JSONSchemaSettings(){
        
    }

    public JSONSchemaSettings(JavaScriptObject jsObj){
        
        setJavaScriptObject(jsObj);
    }



    // ********************* Properties / Attributes ***********************

    /**
     * Prefix for custom annotation keys added to the schema. Must start with <code>"x-"</code> per the JSON Schema
     * specification.
     *
     * @param annotationPrefix New annotationPrefix value. Default value is "x-isc-"
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setAnnotationPrefix(String annotationPrefix) {
        return (JSONSchemaSettings)setAttribute("annotationPrefix", annotationPrefix);
    }

    /**
     * Prefix for custom annotation keys added to the schema. Must start with <code>"x-"</code> per the JSON Schema
     * specification.
     *
     * @return Current annotationPrefix value. Default value is "x-isc-"
     */
    public String getAnnotationPrefix()  {
        return getAttributeAsString("annotationPrefix");
    }
    

    /**
     * When true, <code>asJSONSchema()</code> returns the JSON Schema as a formatted JSON string instead of a plain object.
     *
     * @param asString New asString value. Default value is false
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setAsString(Boolean asString) {
        return (JSONSchemaSettings)setAttribute("asString", asString);
    }

    /**
     * When true, <code>asJSONSchema()</code> returns the JSON Schema as a formatted JSON string instead of a plain object.
     *
     * @return Current asString value. Default value is false
     */
    public Boolean getAsString()  {
        Boolean result = getAttributeAsBoolean("asString", true);
        return result == null ? false : result;
    }
    

    /**
     * When true, event/action binding schemas omit the <code>"params"</code> property, relying on automatic parameter binding.
     * Defaults to true when ISC_Tools.js is loaded and JSDoc data is available.
     *
     * @param autoBindEvents New autoBindEvents value. Default value is null
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setAutoBindEvents(Boolean autoBindEvents) {
        return (JSONSchemaSettings)setAttribute("autoBindEvents", autoBindEvents);
    }

    /**
     * When true, event/action binding schemas omit the <code>"params"</code> property, relying on automatic parameter binding.
     * Defaults to true when ISC_Tools.js is loaded and JSDoc data is available.
     *
     * @return Current autoBindEvents value. Default value is null
     */
    public Boolean getAutoBindEvents()  {
        return getAttributeAsBoolean("autoBindEvents", true);
    }
    

    /**
     * When true, the generated schema is cached on the DataSource, keyed by the JSON serialization of these settings.
     * Subsequent calls with the same settings return the cached result. An empty settings object is cached by default
     * regardless of this flag.
     *
     * @param cacheSchema New cacheSchema value. Default value is false
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setCacheSchema(Boolean cacheSchema) {
        return (JSONSchemaSettings)setAttribute("cacheSchema", cacheSchema);
    }

    /**
     * When true, the generated schema is cached on the DataSource, keyed by the JSON serialization of these settings.
     * Subsequent calls with the same settings return the cached result. An empty settings object is cached by default
     * regardless of this flag.
     *
     * @return Current cacheSchema value. Default value is false
     */
    public Boolean getCacheSchema()  {
        Boolean result = getAttributeAsBoolean("cacheSchema", true);
        return result == null ? false : result;
    }
    

    /**
     * Optional EditContext used to influence event/action schema by providing the set of live editing components and their
     * types.
     *
     * @param editContext New editContext value. Default value is null
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setEditContext(EditContext editContext) {
        return (JSONSchemaSettings)setAttribute("editContext", editContext == null ? null : editContext.getOrCreateJsObj());
    }

    /**
     * Optional EditContext used to influence event/action schema by providing the set of live editing components and their
     * types.
     *
     * @return Current editContext value. Default value is null
     */
    public EditContext getEditContext()  {
        return EditContext.getOrCreateRef(getAttributeAsJavaScriptObject("editContext"));
    }
    

    /**
     * Controls how event handler properties are represented in the generated schema.
     *
     * @param eventMode New eventMode value. Default value is "omit"
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setEventMode(EventSchemaMode eventMode) {
        return (JSONSchemaSettings)setAttribute("eventMode", eventMode == null ? null : eventMode.getValue());
    }

    /**
     * Controls how event handler properties are represented in the generated schema.
     *
     * @return Current eventMode value. Default value is "omit"
     */
    public EventSchemaMode getEventMode()  {
        return EnumUtil.getEnum(EventSchemaMode.values(), getAttribute("eventMode"));
    }
    

    /**
     * Whether to include fields marked <code>advanced:true</code> in the output schema.
     *
     * @param includeAdvanced New includeAdvanced value. Default value is false
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setIncludeAdvanced(Boolean includeAdvanced) {
        return (JSONSchemaSettings)setAttribute("includeAdvanced", includeAdvanced);
    }

    /**
     * Whether to include fields marked <code>advanced:true</code> in the output schema.
     *
     * @return Current includeAdvanced value. Default value is false
     */
    public Boolean getIncludeAdvanced()  {
        Boolean result = getAttributeAsBoolean("includeAdvanced", true);
        return result == null ? false : result;
    }
    

    /**
     * Controls whether and at what granularity descriptions appear on schema properties. If unset, defaults to
     * <code>"brief"</code> when brief descriptions are available (checked via <code>isc.jsdoc.hasBriefDescriptions()</code>),
     * otherwise <code>"none"</code>.
     *
     * @param includeDescriptions New includeDescriptions value. Default value is null
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setIncludeDescriptions(DescriptionMode includeDescriptions) {
        return (JSONSchemaSettings)setAttribute("includeDescriptions", includeDescriptions == null ? null : includeDescriptions.getValue());
    }

    /**
     * Controls whether and at what granularity descriptions appear on schema properties. If unset, defaults to
     * <code>"brief"</code> when brief descriptions are available (checked via <code>isc.jsdoc.hasBriefDescriptions()</code>),
     * otherwise <code>"none"</code>.
     *
     * @return Current includeDescriptions value. Default value is null
     */
    public DescriptionMode getIncludeDescriptions()  {
        return EnumUtil.getEnum(DescriptionMode.values(), getAttribute("includeDescriptions"));
    }
    

    /**
     * Whether to include fields marked <code>hidden:true</code> in the output schema.
     *
     * @param includeHidden New includeHidden value. Default value is false
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setIncludeHidden(Boolean includeHidden) {
        return (JSONSchemaSettings)setAttribute("includeHidden", includeHidden);
    }

    /**
     * Whether to include fields marked <code>hidden:true</code> in the output schema.
     *
     * @return Current includeHidden value. Default value is false
     */
    public Boolean getIncludeHidden()  {
        Boolean result = getAttributeAsBoolean("includeHidden", true);
        return result == null ? false : result;
    }
    

    /**
     * Whether to output non-translatable validator information (such as custom validators) as annotations. Validators that
     * have direct JSON Schema equivalents (minLength, maxLength, minimum, maximum, pattern, enum) are always translated
     * structurally.
     *
     * @param includeValidators New includeValidators value. Default value is true
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setIncludeValidators(Boolean includeValidators) {
        return (JSONSchemaSettings)setAttribute("includeValidators", includeValidators);
    }

    /**
     * Whether to output non-translatable validator information (such as custom validators) as annotations. Validators that
     * have direct JSON Schema equivalents (minLength, maxLength, minimum, maximum, pattern, enum) are always translated
     * structurally.
     *
     * @return Current includeValidators value. Default value is true
     */
    public Boolean getIncludeValidators()  {
        Boolean result = getAttributeAsBoolean("includeValidators", true);
        return result == null ? true : result;
    }
    

    /**
     * Whether to include <code>visibleWhen</code>, <code>enableWhen</code>, <code>readOnlyWhen</code> and similar rules in the
     * schema as annotations.
     *
     * @param includeWhenRules New includeWhenRules value. Default value is false
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setIncludeWhenRules(Boolean includeWhenRules) {
        return (JSONSchemaSettings)setAttribute("includeWhenRules", includeWhenRules);
    }

    /**
     * Whether to include <code>visibleWhen</code>, <code>enableWhen</code>, <code>readOnlyWhen</code> and similar rules in the
     * schema as annotations.
     *
     * @return Current includeWhenRules value. Default value is false
     */
    public Boolean getIncludeWhenRules()  {
        Boolean result = getAttributeAsBoolean("includeWhenRules", true);
        return result == null ? false : result;
    }
    

    /**
     * Maximum nesting depth for recursive DataSource discovery. Intended as an infinite-recursion guard; a  logWarn() is
     * issued if this depth is exceeded.
     *
     * @param maxDepth New maxDepth value. Default value is 250
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setMaxDepth(Integer maxDepth) {
        return (JSONSchemaSettings)setAttribute("maxDepth", maxDepth);
    }

    /**
     * Maximum nesting depth for recursive DataSource discovery. Intended as an infinite-recursion guard; a  logWarn() is
     * issued if this depth is exceeded.
     *
     * @return Current maxDepth value. Default value is 250
     */
    public Integer getMaxDepth()  {
        return getAttributeAsInt("maxDepth");
    }
    

    /**
     * Optional Canvas that provides a ruleScope. When set, the action binding schema enumerates valid target component IDs
     * from  canvas.getRuleScopeDataBoundComponents(), and <code>*When</code> rules include valid field names from the
     * ruleScope.
     *
     * @param ruleScopeSource New ruleScopeSource value. Default value is null
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setRuleScopeSource(Canvas ruleScopeSource) {
        return (JSONSchemaSettings)setAttribute("ruleScopeSource", ruleScopeSource == null ? null : ruleScopeSource.getOrCreateJsObj());
    }

    /**
     * Optional Canvas that provides a ruleScope. When set, the action binding schema enumerates valid target component IDs
     * from  canvas.getRuleScopeDataBoundComponents(), and <code>*When</code> rules include valid field names from the
     * ruleScope.
     *
     * @return Current ruleScopeSource value. Default value is null
     */
    public Canvas getRuleScopeSource()  {
        return (Canvas)Canvas.getByJSObject(getAttributeAsJavaScriptObject("ruleScopeSource"));
    }
    

    /**
     * When true (the default), reusable DataSource types are placed in a <code>$defs</code> block and referenced via
     * <code>$ref</code>. Set to false to use the older <code>definitions</code> keyword instead.
     *
     * @param useDefs New useDefs value. Default value is true
     * @return {@link com.smartgwt.client.data.JSONSchemaSettings JSONSchemaSettings} instance, for chaining setter calls
     */
    public JSONSchemaSettings setUseDefs(Boolean useDefs) {
        return (JSONSchemaSettings)setAttribute("useDefs", useDefs);
    }

    /**
     * When true (the default), reusable DataSource types are placed in a <code>$defs</code> block and referenced via
     * <code>$ref</code>. Set to false to use the older <code>definitions</code> keyword instead.
     *
     * @return Current useDefs value. Default value is true
     */
    public Boolean getUseDefs()  {
        Boolean result = getAttributeAsBoolean("useDefs", true);
        return result == null ? true : result;
    }
    

    // ********************* Methods ***********************

    // ********************* Static Methods ***********************

    // ***********************************************************

}
