package com.konakartadmin.modules.ordertotal.intereses;

import java.util.Date;

import com.konakart.util.Utils;
import com.konakartadmin.app.KKConfiguration;
import com.konakartadmin.bl.KKAdminBase;
import com.konakartadmin.modules.OrderTotalModule;

/**
 * Intereses order total module
 * 
 */
public class Intereses extends OrderTotalModule
{
    /**
     * @return the config key stub
     */
    public String getConfigKeyStub()
    {
        if (configKeyStub == null)
        {
            setConfigKeyStub(super.getConfigKeyStub() + "_INTERESES");
        }
        return configKeyStub;
    }

    public String getModuleTitle()
    {
        return getMsgs().getString("MODULE_ORDER_TOTAL_INTERESES_TEXT_TITLE");
    }

    /**
     * @return the implementation filename - for compatibility with osCommerce we use the php name
     */
    public String getImplementationFileName()
    {
        return "Intereses";
    }

    /**
     * @return the module code
     */
    public String getModuleCode()
    {
        return "ot_intereses";
    }

    /**
     * @return an array of configuration values for this payment module
     */
    public KKConfiguration[] getConfigs()
    {
        if (configs == null)
        {
            configs = new KKConfiguration[2];
        }

        if (configs[0] != null && !Utils.isBlank(configs[0].getConfigurationKey()))
        {
            return configs;
        }

        Date now = KKAdminBase.getKonakartTimeStampDate();

        int i = 0;
        configs[i++] = new KKConfiguration("Display Intereses",
                "MODULE_ORDER_TOTAL_INTERESES_STATUS", "true",
                "Do you want to display the order Intereses cost?", 6, 1, "",
                "tep_cfg_select_option(array('true', 'false'), ", now);
        configs[i++] = new KKConfiguration("Sort Order", "MODULE_ORDER_TOTAL_INTERESES_SORT_ORDER",
                "30", "Sort order of display.", 6, 2, "", "", now);

        return configs;
    }
}
