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


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

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity(name = "ServiceGroup")
@Table(name = "SERVICEGROUPS")
//this is for oracle db @SequenceGenerator(name = "SERVICEGROUP_SEQ", sequenceName = "SERVICEGROUP_SEQ", allocationSize = 1)
@EntityListeners( { BaseEntityListener.class })
public class ServiceGroup extends BaseEntity
{
    private String name;
    private String description;

    public ServiceGroup()
    {
        entityName = "ServiceGroup";
    }

    public ServiceGroup(int id, String name)
    {
        entityName = "ServiceGroup";

        this.id = id;
        this.name = name;
    }

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

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

    @Column(name = "NAME", unique = true, length = 15)
    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    @Column(name = "DESCRIPTION", length = 30)
    public String getDescription()
    {
        return description;
    }

    public void setDescription(String description)
    {
        this.description = description;
    }

    @Override
    public String toString()
    {
        return getName();
    }

}
