import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  Index,
  Unique,
} from 'typeorm';

@Entity('wallets')
@Index('idx_user', ['user_id'])
@Unique(['user_id'])
export class Wallet {
  @PrimaryGeneratedColumn({ type: 'bigint', unsigned: true })
  id: number;

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

  @Column({ type: 'int', default: 0 })
  job_credits: number;

  @Column({ type: 'int', default: 0 })
  database_credits: number;

  @Column({ type: 'int', default: 0 })
  ai_credits: number;

  @CreateDateColumn()
  created_at: Date;
}
