import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity('auth_tokens')
export class AuthTokenEntity {
    @PrimaryGeneratedColumn() id: number;
    @Column() account_id: number;
    @Column({ type: 'varchar', length: 32 }) account_username: string;
    @Column({ type: 'varchar', length: 128 }) token: string;
    @Column({ type: 'datetime' }) expires: Date;
    @Column({ type: 'tinyint' }) persistent: boolean;
    @Column({ type: 'varchar', length: 128 }) serial: string;
    @Column({ type: 'varchar', length: 32 }) ip: string;
    @Column({ type: 'varchar', length: 24 }) socialclub_id: string;
    @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) created: string;
    @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) last_used: string;
}
