import { Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import { Column } from "typeorm/browser";
import StoreEntity from "./store.entity";

@Entity({name: "device"})
export default class DeviceEntity {

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

    @PrimaryGeneratedColumn()
    id?: number;

    @Column()
    code?: string;

    @Column()
    title?: string;

    @Column({name: "fiscal_printer_ip"})
    fiscalPrinterIp?: string;

    @Column({name: "fiscal_printer_model"})
    fiscalPrinterModel?: string;

    @Column({name: "fiscal_printer_serial"})
    fiscalPrinterSerial?: string;

    @Column({name: "no_fiscal_printer_ip"})
    noFiscalPrinterIp?: string;

    @JoinColumn({name: "id_store"})
    @ManyToOne(type => StoreEntity)
    store?: StoreEntity; 

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

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


}