package com.fp.dto.data;

import java.io.Serializable;

public class TransactionDTO implements Serializable, Comparable<TransactionDTO> {
    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 1L;

    private String module;

    private Integer transaction;

    private Integer version;

    /**
     * Entrega el valor de module
     * 
     * @return Valor de module
     */
    public String getModule() {
        return this.module;
    }

    /**
     * Fija un nuevo valor en module
     * 
     * @param module nuevo valor para module
     */
    public void setModule(String module) {
        this.module = module;
    }

    /**
     * Entrega el valor de transaction
     * 
     * @return Valor de transaction
     */
    public Integer getTransaction() {
        return this.transaction;
    }

    /**
     * Fija un nuevo valor en transaction
     * 
     * @param transaction nuevo valor para transaction
     */
    public void setTransaction(Integer transaction) {
        this.transaction = transaction;
    }

    /**
     * Entrega el valor de version
     * 
     * @return Valor de version
     */
    public Integer getVersion() {
        return this.version;
    }

    /**
     * Fija un nuevo valor en version
     * 
     * @param version nuevo valor para version
     */
    public void setVersion(Integer version) {
        this.version = version;
    }

    @Override
    public int compareTo(TransactionDTO o) {
        int mod = this.module.compareTo(o.module);
        if (mod != 0) {
            return mod;
        }
        int trn = this.transaction.compareTo(o.transaction);
        if (trn != 0) {
            return trn;
        }
        int ver = this.version.compareTo(o.version);
        if (ver != 0) {
            return ver;
        }
        return 0;
    }

    public TransactionDTO(String module, Integer transaction, Integer version) {
        this.module = module;
        this.transaction = transaction;
        this.version = version;
    }

    public TransactionDTO() {
    }

    @Override
    public String toString() {
        return this.module + "," + this.transaction + "," + this.version;
    }

}
