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

import java.math.BigDecimal;

import com.fp.dto.Response;
import com.fp.dto.save.SaveRequest;

// TODO: Auto-generated Javadoc
/**
 * Class RequestTester encargada de.
 * 
 * @author gfiallos
 */
public class RequestTester extends SaveRequest {

    /** serialVersionUID. */
    private static final long serialVersionUID = 1L;

    /**
     * Crea una nueva instancia de request tester.
     */
    public RequestTester() {
        super.setResponse(new Response(Response.RESPONSE_OK, ""));
    }

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

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

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

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

    /**
     * Change term.
     * 
     * @param pTerm the term
     */
    public void changeTerm(Integer pTerm) {
        this.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.put(val[0], val[1]);
    }

    /**
     * Adiciona un rule parameter value.
     * 
     * @param pValue the value
     */
    public void addRuleParameterValue(String pValue) {
        String[] val = pValue.split(",");
        this.addRuleParameter(val[0], val[1]);
    }

    /**
     * Obtiene el valor de rule data.
     * 
     * @return Valor de rule data
     */
    public String getRuleData() {
        return "" + this.ruleParameters;
    }

}
