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

@Entity({name: "document_storage"})
export default class DocumentStorageEntity {

    @PrimaryGeneratedColumn()
    id?: number;

    @Column()
    code?: string;

    @Column()
    title?: string;

    @JoinColumn({name: "id_storage"})
    @ManyToOne(type => StorageEntity)
    storage?: StorageEntity;

    @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;

}