/********************************************************************
 * Copyright © 2004 VHA. All rights reserved
 ********************************************************************/
package gov.va.med.esr.common.model.system;

import java.util.HashMap;
import java.util.Map;

import gov.va.med.fw.model.AbstractKeyedEntity;

import gov.va.med.esr.common.model.lookup.Capability;
import gov.va.med.esr.common.model.lookup.SystemParameterType;
import gov.va.med.esr.common.model.lookup.SystemParameterUnit;
import gov.va.med.esr.common.model.lookup.Capability.Code;

/**
 * @author DNS   KATIKM
 *
 */
public class SystemParameter extends AbstractKeyedEntity implements Comparable{

    private static final long serialVersionUID = 7809728615369188107L;

    public static final String PASSWORD_ACTIVE_DAYS = "Password Active Days";
    public static final String PASSWORD_EXPIRED_DAYS = "Password Expired Days";
    public static final String FAILED_ATTEMPTS = "Failed Attempts";
    public static final String RETRANSMIT_EXECUTION_PERIOD = "Retransmit Execution Period";
    public static final String RETRANSMIT_DAYS = "Retransmit Days";
    public static final String MAXIMUM_RETRANSMITION_COUNT = "Maximum Retransmission Count";
    public static final String RETRANSMIT_EXECUTION_PERIOD_EGT = "Retransmit Execution Period for EGT";
    public static final String RETRANSMIT_DAYS_EGT = "Retransmit Days for EGT";
    public static final String MAXIMUM_RETRANSMITION_COUNT_EGT = "Maximum Retransmission Count for EGT";
    public static final String SSA_SSN_VERIFICATION_FREQUENCY = "SSA SSN Verification Frequency";
    public static final String IVM_DM_IY_CUTOFF_DATE = "IVM DM IY Cut Off Date";
    public static final String IVM_DM_EXPORTER_MAX_RECORDS = "IVM DM Exporter Maximum Records";
    public static final String DUPLICATE_THRESHOLD_VALUE = "Duplicate Threshold Value";
    public static final String ESR_IMPLEMENTATION_DATE = "ESR Implementation Date";
    public static final String ENROLLMENT_REGULATION_DATE = "Enrollment Regulation Date";
    public static final String DATE_UNIT = "7";
    public static final String ARCHIVE_REPORTS_PARAMETER = "Archive Reports Parameter";
    public static final String PURGE_ARCHIVE_REPORTS_PARAMETER = "Purge Archived Reports Parameter";
    public static final String AO_TREATMENT_AUTHORITY_IND = "Agent Orange Special Treatment Authority Indicator";
    public static final String AO_TREATMENT_AUTHORITY_EXP_DATE = "Agent Orange Special Treatment Authority Exp Date";
    public static final String SWAC_TREATMENT_AUTHORITY_IND = "SW Asia Cond. Special Treatment Authority Ind";
    public static final String SWAC_TREATMENT_AUTHORITY_EXP_DATE = "SW Asia Cond. Special Treatment Authority Exp Date";
    public static final String HANDBOOK_ACTIVE = "Handbook Active";
    public static final String MSDS_SERVICE_INDICATOR = "MSDS Service Indicator";
    public static final String VOA_ANONYMOUS_LEVEL1_PROCESS_INDICATOR ="VOA Anonymous/Level 1 Process Indicator";
    public static final String MSDS_RECON_INDICATOR = "MSDS Reconciliation Indicator";
    public static final String DEFAULT_HANDBOOK_BATCH_RELEASE_CONTROL_NUMBER = "Default Handbook Batch Release Control Number";
    public static final String HANDBOOK_ROLL_OUT_OVER="HANDBOOK ROLL OUT OVER";
    //change this to the correct value once database request is complete
    public static final String VBA_DATA_SHARING_INDICATOR = "VBA Data Sharing Indicator";
    public static final String VFA_START_DATE = "VFA Start Date";
    public static final String HBP_DATA_SHARING_INDICATOR = "HBP Data sharing indicator"; //CCR12064
    public static final String IVM_FINAL_LETTER_INDICATOR = "IVM Final Letter Indicator"; // CCR 12906

    public static final String DOD_INDICATOR = "Use MVI Date of Death Service Indicator";

    //CCR13856
    public static final String DOD_SHARING = "Transmit Date of Death Indicator";
    public static final String ES_SID_INDICATOR = "ES SID Indicator";
    public static final String CL_VISTA_ROLLOUT_INDICATOR = "CL_VISTA_FULL_ROLLOUT"; //CL-V_CodeCR13540

    public static final String VC_VISTA_ROLLOUT_INDICATOR = "VC_VISTA_FULL_ROLLOUT"; //VC CR13726

    private String description = null;
    private String name = null;
    private SystemParameterType type = null;
    private Integer dataLength = null;
    private SystemParameterUnit unit = null;
    private String value = null;
    private Integer inActiveFlag = null;
    private String applicationName = null;

    public Integer getDataLength() {
        return dataLength;
    }
    public void setDataLength(Integer dataLength) {
        this.dataLength = dataLength;
    }
    public Integer getInActiveFlag() {
        return inActiveFlag;
    }
    public void setInActiveFlag(Integer inActiveFlag) {
        this.inActiveFlag = inActiveFlag;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public SystemParameterType getType() {
        return type;
    }
    public void setType(SystemParameterType type) {
        this.type = type;
    }
    public SystemParameterUnit getUnit() {
        return unit;
    }
    public void setUnit(SystemParameterUnit unit) {
        this.unit = unit;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public String getApplicationName() {
        return applicationName;
    }
    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    /**
     * Statically defined Capability Map
     * TODO - define the list in the database
     * @return
     */
    public static Map getCapabilityMap() {
    	Map map = new HashMap ();
    	map.put(PASSWORD_ACTIVE_DAYS, 			Capability.EDIT_PASSWORD_ACTIVE_DAYS.getName());
    	map.put(PASSWORD_EXPIRED_DAYS, 			Capability.EDIT_PASSWORD_EXPIRED_DAYS.getName());
    	map.put(FAILED_ATTEMPTS, 				Capability.EDIT_FAILED_ATTEMPTS.getName());
    	map.put(RETRANSMIT_EXECUTION_PERIOD, 	Capability.EDIT_RETRANSMIT_EXEC_PERIOD.getName());
    	map.put(RETRANSMIT_DAYS, 				Capability.EDIT_RETRANSMIT_DAYS.getName());
    	map.put(MAXIMUM_RETRANSMITION_COUNT, 	Capability.EDIT_MAX_RETRANSMIT_COUNT.getName());
    	map.put(SSA_SSN_VERIFICATION_FREQUENCY, Capability.EDIT_SSA_SSN_VERIFICATION_FREQUENCY.getName());
    	map.put(DUPLICATE_THRESHOLD_VALUE, 		Capability.EDIT_DUPLICATE_THRESHOLD_VALUE.getName());
    	map.put(IVM_DM_IY_CUTOFF_DATE, 			Capability.EDIT_IVM_DM_IY_CUTOFF_DATE.getName());
    	// CCR 11892 REMOVE IVM DM Ongoing Exporter Maximum Records Parameter
    	return map;
    }

    //Orderes the collection by the name of the parameter
    public int compareTo(Object o) {
        if (o==null || !(o instanceof SystemParameter)) return 1;
        else return this.getName().compareTo(((SystemParameter)o).getName());
    }
}
