import { Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm';
import { CharacterEntity } from './character.entity';

@Entity('admin_notes')
export class AdminNoteEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column() character_id: number;
    @Column() account_id: number;
    @Column({ type: 'varchar', length: 34 }) account_name: string;

    @Column() admin_account_id: number;
    @Column({ type: 'varchar', length: 34 }) admin_account_name: string;

    @Column({ type: 'longtext' }) note: string;
    @Column() alert_type: number;

    @Column({ type: 'datetime' }) expiration: string;
    @Column({ type: 'datetime', default: null, nullable: true }) expired: string | null;
    @Column({ type: 'datetime' }) created: string;

    @OneToOne(() => CharacterEntity)
    @JoinColumn({
        name: 'character_id',
        referencedColumnName: 'id',
    })
    character?: CharacterEntity;
}
