package com.sonymusic.dx.persistence.gras;

import java.io.Serializable;
import java.sql.Timestamp;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToOne;
import jakarta.persistence.PrimaryKeyJoinColumn;
import jakarta.persistence.Table;

@Entity
@Table(name = "vgras040_v035")
public class ProductAudioBookInfo extends RAASClientSpecificEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "prod_no", nullable = false, length = 14)
    private String productNo;

    @OneToOne(optional = false, fetch = FetchType.EAGER)
    @PrimaryKeyJoinColumn(name = "prod_no", referencedColumnName = "prod_no")
    private Product product;

    @Column(name = "isbn")
    private String isbn;

    @Column(name = "gtin14")
    private String gtin;

    @Column(name = "is_confidential", nullable = false, length = 1)
    private String isConfidential;

    @Column(name = "mod_stamp", insertable = false, updatable = false)
    private Timestamp modStamp;

    public String getProductNo() {
        return productNo;
    }

    public void setProductNo(String productNo) {
        this.productNo = productNo;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    public String getGtin() {
        return gtin;
    }

    public void setGtin(String gtin) {
        this.gtin = gtin;
    }

    public String getIsConfidential() {
        return isConfidential;
    }

    public void setIsConfidential(String isConfidential) {
        this.isConfidential = isConfidential;
    }

    public Timestamp getModStamp() {
        return modStamp;
    }

    public void setModStamp(Timestamp modStamp) {
        this.modStamp = modStamp;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((productNo == null) ? 0 : productNo.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        ProductAudioBookInfo other = (ProductAudioBookInfo) obj;
        if (productNo == null) {
            if (other.productNo != null)
                return false;
        } else if (!productNo.equals(other.productNo))
            return false;
        return true;
    }

}