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

@Entity('maze_pay_accounts')
export class MazePayAccountEntity {
    @PrimaryGeneratedColumn() id: number;
    @Index()
    @Column()
    character_id: number;
    @Column({ type: 'varchar', length: 16 }) character_name: string;
    @Column() bank_account_id: number;
    @Column({ type: 'varchar', length: 16 }) tag: string;
    @Column({ type: 'varchar', length: 64 }) legal_name: string;
    @Column({ type: 'varchar', length: 16, default: 'teal' }) theme: string;

    @ManyToOne(() => BankAccountEntity, (bae) => bae.mazePayAccounts)
    @JoinColumn({ name: 'bank_account_id' })
    bankAccount: BankAccountEntity;

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