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

@Entity('gangnet_auth')
export class GangNetAuthEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column({ type: 'int' }) character_id: number;
    @Column({ type: 'datetime' }) granted: Date;
    @Column({ type: 'int' }) granted_by: number;
    @Column({ type: 'varchar', width: 50 }) granted_by_name: string;
    @Column({ type: 'varchar', width: 20, default: 'read-only' }) permission: string;

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