/*
 *  Copyright 2017 Anyware Services
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

/**
 * Singleton class helper for count extraction components edition.
 * @private
 */
 Ext.define('Ametys.plugins.extraction.edition.EditCountExtractionComponentDialog', {
    extend: "Ametys.plugins.extraction.edition.EditGroupExtractionComponentDialog",
    singleton: true,
    
    /**
     * @protected
     * Retrieve the dialog title
     * @return {String} the dialog title
     */
    _getDialogTitle: function ()
    {
        if (this._mode == 'new')
        {
            return "{{i18n PLUGINS_EXTRACTION_ADD_COUNT_DIALOG_TITLE}}";
        }
        return "{{i18n PLUGINS_EXTRACTION_EDIT_COUNT_DIALOG_TITLE}}";
    },
    
    /**
     * @protected
     * Retrieve the dialog icon class
     * @return {String} the dialog icon class
     */
    _getDialogIconCls: function ()
    {
        return "ametysicon-abacus";
    },
    
    /**
     * @protected
     * Retrieves the form configuration elements
     * @param {Object} response needed information to configure form
     * @return {Object} the form configuration element
     */
    _getFormConfiguration: function(response)
    {
        var configuration = {};
        
        // Tag name field
        Ext.apply(configuration, this._getTagNameFormConfiguration());
        
        // Clauses field
        Ext.apply(configuration, this._getClausesFormConfiguration());
        
        // Grouping fields
        Ext.apply(configuration, this._getGroupingFieldsFormConfiguration());
        
        // query type and content types or saved query field
        Ext.apply(configuration, this._getQueryTypeFormConfiguration());
        
        return configuration;
    }
 });