package net.sevecek.dailyplanet;

import java.util.*;

public class Autor {

    private UUID autorId;
    private String krestniJmeno;
    private String prijmeni;
    private String email;
    private String telefon;

    @Deprecated
    public Autor() {
    }

    public Autor(UUID autorId) {
        if (autorId == null) {
            autorId = UUID.randomUUID();
        }
        this.autorId = autorId;
    }

    public Autor(String krestniJmeno, String prijmeni, String email) {
        this.krestniJmeno = krestniJmeno;
        this.prijmeni = prijmeni;
        this.email = email;
    }

    public UUID getAutorId() {
        return autorId;
    }

    @Deprecated
    public void setAutorId(UUID newValue) {
        autorId = newValue;
    }

    public String getKrestniJmeno() {
        return krestniJmeno;
    }

    public void setKrestniJmeno(String newValue) {
        krestniJmeno = newValue;
    }

    public String getPrijmeni() {
        return prijmeni;
    }

    public void setPrijmeni(String newValue) {
        prijmeni = newValue;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String newValue) {
        email = newValue;
    }

    public String getTelefon() {
        return telefon;
    }

    public void setTelefon(String newValue) {
        telefon = newValue;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Autor)) return false;
        Autor autor = (Autor) o;

        if (getAutorId() == null) return false;
        return getAutorId().equals(autor.getAutorId());
    }

    @Override
    public int hashCode() {
        if (getAutorId() == null) return 0;
        return getAutorId().hashCode();
    }
}
