import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { GangNetPersonEntity } from './gangnet-person.entity';
import { GangNetEntity } from './gangnet.entity';

@Entity('gangnet_person_comments')
export class GangnetPersonCommentEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column({ type: 'int' }) gangnet_person_id: number;
    @Column({ type: 'text' }) comment: string;
    @Column({ type: 'datetime' }) time: Date;
    @Column({ type: 'int' }) added_by: number;
    @Column({ type: 'varchar', width: 80 }) added_by_name: string;

    @ManyToOne(() => GangNetPersonEntity, (person) => person.comments)
    @JoinColumn({ name: 'gangnet_person_id' })
    gangnet_person: GangNetPersonEntity;

    @ManyToOne(() => GangNetPersonEntity, (net) => net.comments)
    @JoinColumn({ name: 'gangnet_person_id' })
    gangnet: GangNetEntity;
}
