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;

@Entity(name = "Table")
@javax.persistence.Table(name = "TABLES")
//this is for oracle db @SequenceGenerator(name = "TABLE_SEQ", sequenceName = "TABLE_SEQ", allocationSize = 1)
@EntityListeners( { BaseEntityListener.class })
public class Table extends BaseEntity
{
    private String name;
    private int capacity;

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

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

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

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

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

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

    @Column(name = "NAME")
    public String getName()
    {
        return name;
    }

    public void setCapacity(int capacity)
    {
        this.capacity = capacity;
    }

    @Column(name = "CAPACITY")
    public int getCapacity()
    {
        return capacity;
    }

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