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

@Entity('taxi_licenses')
export class TaxiLicenseEntity {
    @PrimaryGeneratedColumn() id: number;

    @Column({ type: 'int' }) character_id: number;

    @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) issued: Date;

    @Column({ type: 'datetime', nullable: true, default: null }) revoked: Date | null;

    @Column({ type: 'int', nullable: true, default: null }) revoked_by_character_id: number | null;

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