package eu.dnetlib.goldoa.domain;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.google.gwt.user.client.rpc.IsSerializable;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name="alternative_funding_bids")
public class AlternativeFundingBid implements IsSerializable {

    @Id
    private String id;
    @Column(columnDefinition = "text",nullable=false)
    private String round;

    private Integer bidNo;

    @Column(columnDefinition = "text",nullable=false)
    private String bidName;

    @OneToOne
    @JoinColumn(name="organization")
    private Organization organization;

    @OneToOne
    @JoinColumn(name="country")
    private Country country;

    private Double totalAmountRequested;
    private Double firstPayment;
    private Double secondPayment;
    private Timestamp contractStartDate;
    private Timestamp contractEndDate;

    @OneToOne(cascade=CascadeType.ALL)
    @JoinColumn(name="contract")
    @JsonBackReference(value = "contract")
    private File contract;

    @OneToOne
    @JoinColumn(name="first_invoice")
    @JsonBackReference(value = "first_invoice")
    private Invoice firstInvoice;

    @OneToOne
    @JoinColumn(name="second_invoice")
    @JsonBackReference(value = "second_invoice")
    private Invoice secondInvoice;

    @OneToOne(cascade=CascadeType.ALL)
    @JoinColumn(name="firstPaymentDocument")
    @JsonBackReference(value = "first_receipt")
    private BankTransferReceipt firstPaymentDocument;

    @OneToOne(cascade=CascadeType.ALL)
    @JoinColumn(name="secondPaymentDocument")
    @JsonBackReference(value = "second_receipt")
    private BankTransferReceipt secondPaymentDocument;


    public String getRound() {
        return round;
    }

    public void setRound(String round) {
        this.round = round;
    }

    public int getBidNo() {
        return bidNo;
    }

    public void setBidNo(Integer bidNo) {
        this.bidNo = bidNo;
    }

    public String getBidName() {
        return bidName;
    }

    public void setBidName(String bidName) {
        this.bidName = bidName;
    }

    public Organization getOrganization() {
        return organization;
    }

    public void setOrganization(Organization organization) {
        this.organization = organization;
    }

    public Country getCountry() {
        return country;
    }

    public void setCountry(Country country) {
        this.country = country;
    }

    public Double getTotalAmountRequested() {
        return totalAmountRequested;
    }

    public void setTotalAmountRequested(Double totalAmountRequested) {
        this.totalAmountRequested = totalAmountRequested;
    }

    public Double getFirstPayment() {
        return firstPayment;
    }

    public void setFirstPayment(Double firstPayment) {
        this.firstPayment = firstPayment;
    }

    public Double getSecondPayment() {
        return secondPayment;
    }

    public void setSecondPayment(Double secondPayment) {
        this.secondPayment = secondPayment;
    }

    public Timestamp getContractStartDate() {
        return contractStartDate;
    }

    public void setContractStartDate(Timestamp contractStartDate) {
        this.contractStartDate = contractStartDate;
    }

    public Timestamp getContractEndDate() {
        return contractEndDate;
    }

    public void setContractEndDate(Timestamp contractEndDate) {
        this.contractEndDate = contractEndDate;
    }

    public File getContract() {
        return contract;
    }

    public void setContract(File contract) {
        this.contract = contract;
    }

    public Invoice getFirstInvoice() {
        return firstInvoice;
    }

    public void setFirstInvoice(Invoice firstInvoice) {
        this.firstInvoice = firstInvoice;
    }

    public Invoice getSecondInvoice() {
        return secondInvoice;
    }

    public void setSecondInvoice(Invoice secondInvoice) {
        this.secondInvoice = secondInvoice;
    }

    public BankTransferReceipt getFirstPaymentDocument() {
        return firstPaymentDocument;
    }

    public void setFirstPaymentDocument(BankTransferReceipt firstPaymentDocument) {
        this.firstPaymentDocument = firstPaymentDocument;
    }

    public BankTransferReceipt getSecondPaymentDocument() {
        return secondPaymentDocument;
    }

    public void setSecondPaymentDocument(BankTransferReceipt secondPaymentDocument) {
        this.secondPaymentDocument = secondPaymentDocument;
    }

    public String getId() {
        return id;
    }

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