/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.arrebol.apc.model.views;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 *
 * @author David Rodriguez
 */
@Entity
@Table(name = "APC_STATS_GASOLINE_VIEW")
public class StatsGasolineView implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid2")
    @Column(name = "id", length = 36)
    private String id;

    @Column(name = "id_user", length = 36)
    private String idUser;
    
    @Column(name = "id_route", length = 36)
    private String idRoute;

    @Column(name = "route_name")
    private String routeName;
    
    @Column(name = "user_name")
    private String userName;

    @Column(name = "km_old")
    private Double kmOld;
    
    @Column(name = "km_new")
    private Double kmNew;
    
    @Column(name = "total_gasoline")
    private Double totalGasoline;
    
    @Column(name = "description", length = 36)
    private String description;

    @Column(name = "created_on")
    private Date createdOn;
    
    @Column(name = "quantity")
    private Double quantity;

    public Double getQuantity() {
        return quantity;
    }

    public void setQuantity(Double quantity) {
        this.quantity = quantity;
    }
    
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getIdUser() {
        return idUser;
    }

    public void setIdUser(String idUser) {
        this.idUser = idUser;
    }

    public String getIdRoute() {
        return idRoute;
    }

    public void setIdRoute(String idRoute) {
        this.idRoute = idRoute;
    }

    public String getRouteName() {
        return routeName;
    }

    public void setRouteName(String routeName) {
        this.routeName = routeName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Double getKmOld() {
        return kmOld;
    }

    public void setKmOld(Double kmOld) {
        this.kmOld = kmOld;
    }

    public Double getKmNew() {
        return kmNew;
    }

    public void setKmNew(Double kmNew) {
        this.kmNew = kmNew;
    }

    public Double getTotalGasoline() {
        return totalGasoline;
    }

    public void setTotalGasoline(Double totalGasoline) {
        this.totalGasoline = totalGasoline;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getCreatedOn() {
        return createdOn;
    }

    public void setCreatedOn(Date createdOn) {
        this.createdOn = createdOn;
    }
    
    public Double getKmRecorridos(){
        return getKmNew() - (getKmOld() != null ? getKmOld() : 0D );
    }
    
    public Double getRendimiento(){
        return getKmRecorridos()/getQuantity();
    }
}
