import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { TenderMaster } from "src/tables/tender-master/tender-master.entity";
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
import { DocumentType } from "../document-type/document-type.entity";

@Entity("tender-doc")
export class TenderDoc extends PcdBaseEntity{
 @PrimaryColumn({
    name:"id"
 })
 id:number
 @Column({
    name:"tender_id",
    type:"numeric",
   // length:500,
    nullable:true
 })
 tenderId:number
 @Column({
    name:"doc_name",
    type:"varchar",
    length:500,
    nullable:true
 })
 docName:string
 @Column({
    name:"doc_type",
    type:"varchar",
    nullable:true
 })
 docType:string
 @Column({
    name:"description",
    type:"varchar",
    length:500,
    nullable:true
 })
 description:string

 @Column({
   name:"document_size",
   type:"numeric",
   nullable:true
 })
 documentSize:number;

 
 @ManyToOne(() => TenderMaster,(tenderMaster)=> tenderMaster.TenderDoc)
 @JoinColumn([{ name: "tender_id", referencedColumnName: "id" }])
 tenderIdD:TenderMaster

 @ManyToOne(() => DocumentType,(documentType)=> documentType.tenderDoc,{eager:true})
    @JoinColumn([{ name: "doc_type", referencedColumnName: "id" }])
    documentTypeD:DocumentType
 

}