import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from "typeorm";
import OperatorEntity from "./operator.entity";
import DocumentEntity from "./document.entity";

@Entity({name: "document_operator"})
export default class DocumentOperatorEntity {

    @PrimaryGeneratedColumn()
    id?: number;
    
    @Column()
    code?: string;

    @Column()
    title?: string;

    @JoinColumn({name: "id_operator"})
    @ManyToOne(type => OperatorEntity)
    operator?: OperatorEntity;

    @JoinColumn({name: "id_document"})
    @ManyToOne(type => DocumentEntity)
    document?: DocumentEntity;

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

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

}