package com.acme.model.domain.sc.entity;


import com.acme.structure.BaseEntity;
import com.acme.structure.BaseEntityListener;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

@Entity(name = "Comment")
@Table(name = "COMMENTS")
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "COMMENTTYPE", discriminatorType = DiscriminatorType.STRING, length = 30)
@DiscriminatorValue("Comment")
//this is for oracle db @SequenceGenerator(name = "COMMENT_SEQ", sequenceName = "COMMENT_SEQ", allocationSize = 1)
@EntityListeners( { BaseEntityListener.class })
public class Comment extends BaseEntity
{
    private boolean ratedPoor;
    private boolean ratedAverage;
    private boolean ratedGood;
    private boolean ratedExcellent;
    private String detail;
    private String commentType;

    public Comment()
    {
        entityName = "Comment";
        setCommentType(this.getEntityName());
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO) //, this is for oracle db, generator = "COMMENT_SEQ")
    @Column(name = "ID")
    public int getId()
    {
        return id;
    }

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

    @Column(name = "RATEDAVERAGE")
    public boolean isRatedAverage()
    {
        return ratedAverage;
    }

    public void setRatedAverage(boolean ratedAverage)
    {
        this.ratedAverage = ratedAverage;
    }

    @Column(name = "RATEDEXCELLENT")
    public boolean isRatedExcellent()
    {
        return ratedExcellent;
    }

    public void setRatedExcellent(boolean ratedExcellent)
    {
        this.ratedExcellent = ratedExcellent;
    }

    @Column(name = "RATEDGOOD")
    public boolean isRatedGood()
    {
        return ratedGood;
    }

    public void setRatedGood(boolean ratedGood)
    {
        this.ratedGood = ratedGood;
    }

    @Column(name = "RATEDPOOR")
    public boolean isRatedPoor()
    {
        return ratedPoor;
    }

    public void setRatedPoor(boolean ratedPoor)
    {
        this.ratedPoor = ratedPoor;
    }

    @Column(name = "DETAIL", length = 500)
    public String getDetail()
    {
        return detail;
    }

    public void setDetail(String detail)
    {
        this.detail = detail;
    }

    public void setCommentType(String commentType)
    {
        this.commentType = commentType;
    }

    @Column(name = "COMMENTTYPE", length = 30)
    public String getCommentType()
    {
        return commentType;
    }

    @Override
    public String toString()
    {
        return getCommentType() + " - " + getId();
    }
}
