import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import { GangnetCommentEntity } from './gangnet-comment.entity';
import { GangNetPersonEntity } from './gangnet-person.entity';

@Entity('gangnet')
export class GangNetEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column({ type: 'varchar', width: 50 }) name: string;
    @Column({ type: 'varchar', width: 40 }) location: string;
    @Column({ type: 'text' }) description: string;
    @Column({ type: 'datetime' }) added_date: Date;
    @Column({ type: 'int' }) added_character_id: number;
    @Column({ type: 'varchar', width: 80 }) added_name: string;

    @OneToMany(() => GangnetCommentEntity, (comments) => comments.gangnet)
    comments: GangnetCommentEntity[];

    @OneToMany(() => GangNetPersonEntity, (person) => person.gangnet)
    persons: GangNetPersonEntity[];
}
