/*
 * 
 */
package com.fp.simple.test;

import java.math.BigDecimal;
import java.util.HashMap;

import com.fp.dto.save.SaveRequest;

// TODO: Auto-generated Javadoc
/**
 * Class RuleTester encargada de.
 * 
 * @author gfiallos
 */
public class RuleTester extends HashMap<String, Object> {
    
    /** serialVersionUID. */
    private static final long serialVersionUID = 1L;
    /** El valor de sr. */
    private SaveRequest sr;

    /**
     * Crea una nueva instancia de rule tester.
     */
    public RuleTester() {
        this.sr = new SaveRequest();
        super.put("request", this.sr);
    }

    /**
     * Change branch.
     * 
     * @param pBranch the branch
     */
    public void changeBranch(Integer pBranch) {
        this.sr.setBranchCode(pBranch);
    }

    /**
     * Change officer.
     * 
     * @param pOfficer the officer
     */
    public void changeOfficer(String pOfficer) {
        this.sr.put("officer", pOfficer);
    }

    /**
     * Change ammount.
     * 
     * @param pAmount the amount
     */
    public void changeAmmount(BigDecimal pAmount) {
        this.sr.put("amount", pAmount);
    }

    /**
     * Change rate.
     * 
     * @param pRate the rate
     */
    public void changeRate(BigDecimal pRate) {
        this.sr.put("rate", pRate);
    }

    /**
     * Change term.
     * 
     * @param pTerm the term
     */
    public void changeTerm(Integer pTerm) {
        this.sr.put("term", pTerm);
    }

    /**
     * Obtiene el valor de action.
     * 
     * @return Valor de action
     */
    public String getAction() {
        return (String) super.get("action");
    }

    /**
     * Obtiene el valor de internal code.
     * 
     * @return Valor de internal code
     */
    public String getInternalCode() {
        return (String) super.get("internalCode");

    }

    /**
     * Obtiene el valor de group id.
     * 
     * @return Valor de group id
     */
    public String getGroupId() {
        return (String) super.get("groupId");

    }

    /**
     * Obtiene el valor de user id.
     * 
     * @return Valor de user id
     */
    public String getUserId() {
        return (String) super.get("userId");
    }

    /**
     * Change value.
     * 
     * @param pValue the value
     */
    public void changeValue(String pValue) {
        String[] val = pValue.split(",");
        this.sr.put(val[0], val[1]);
    }
}
