package com.sonymusic.dx.persistence.gras;

import jakarta.persistence.*;

@Entity
@Table(name = "vgras063")
public class Genre extends RAASClientSpecificEntity {

    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "genre_key")
    private String genreKey;
    @Column(name = "genre_name")
    private String genreName;
    @ManyToOne(optional = true, fetch = FetchType.LAZY)
    @JoinColumn(name = "prod_class_key")
    private ProductClass productClass;

    /**
     * Protected, no-argument constructor should only be used by persistence engine.
     */
    protected Genre() {}

    public String getGenreKey() {
        return genreKey;
    }

    public void setGenreKey(String genreKey) {
        this.genreKey = genreKey;
    }

    public String getGenreName() {
        return genreName;
    }

    public void setGenreName(String genreName) {
        this.genreName = genreName;
    }

    public ProductClass getProductClass() {
        return productClass;
    }

    public void setProductClass(ProductClass productClass) {
        this.productClass = productClass;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((genreKey == null) ? 0 : genreKey.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;
        final Genre other = (Genre) obj;
        if (genreKey == null) {
            if (other.genreKey != null)
                return false;
        } else if (!genreKey.equals(other.genreKey))
            return false;
        return true;
    }
}

