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

@Entity('character_name_changes')
export class CharacterNameChangesEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column({ type: 'int' }) account_id: number;
    @Column({ type: 'int' }) character_id: number;
    @Column({ type: 'varchar', length: 64 }) from: string;
    @Column({ type: 'varchar', length: 64 }) to: string;
    @Column({ type: 'datetime' }) date: Date;
    @Column({ type: 'tinyint' }) is_ck: boolean;
    @Column({ type: 'int' }) changed_by_account_id: number;

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