import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";

@Entity({name: "category"})
export default class CategoryEntity {

    constructor(id?: number){
        this.id = id;
    }

    @PrimaryGeneratedColumn()
    id?: number;

    @Column()
    code?: string;

    @Column()
    title?: string;

    @Column()
    subtitle?: string;

    @Column()
    color?: string;

    @Column({name: "available_on_pos"})
    availableOnPos?: number;

    @JoinColumn({name: "id_category"})
    @ManyToOne(type => CategoryEntity)
    category?: CategoryEntity;

    @Column(
        { type: "datetime", name: "created_at" }
    )
    createdAt?: Date;

    @Column(
        { type: "datetime", name: "updated_at" }
    )
    updatedAt?: Date;

}