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

@Entity('kicks')
export class KickEntity {
    @PrimaryGeneratedColumn() id: number;
    @Index()
    @Column()
    account_id: number;
    @Column({ type: 'varchar', length: 64 }) account_name: string;
    @Index()
    @Column()
    character_id: number;
    @Column({ type: 'varchar', length: 64 }) character_name: string;
    @Column({ type: 'varchar', length: 16 }) player_ip: string;
    @Column() kicker_account_id: number;
    @Column({ type: 'varchar', length: 64 }) kicker_name: string;
    @Column({ type: 'varchar', length: 256 }) reason: string;
    @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) date: string;

    @ManyToOne(() => CharacterEntity)
    @JoinColumn({ name: 'character_id' })
    character?: CharacterEntity;
}
