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

@Entity('wallets')
export class WalletEntity {
  @PrimaryGeneratedColumn('uuid')
  id!: string;

  @Column({ name: 'name', type: 'varchar', length: 100, default: 'Wallet' })
  name!: string;

  @Column({ name: 'sync_type', type: 'enum', enum: ['created', 'imported'] })
  syncType!: 'created' | 'imported';

  @Column({ name: 'synced_at' })
  syncedAt!: Date;

  @Column({ name: 'encrypted_phrase', type: 'text' })
  encryptedPhrase!: string;

  @Column({ name: 'device_ids', type: 'json' })
  deviceIds!: string[];

  @Column({ name: 'is_admin', default: false })
  isAdmin!: boolean;

  @Column({ name: 'is_active', default: true })
  isActive!: boolean;

  @Column({ name: 'last_accessed_at' })
  lastAccessedAt!: Date;

  @Column({ default: 1 })
  version!: number;

  @CreateDateColumn({ name: 'created_at' })
  createdAt!: Date;

  @UpdateDateColumn({ name: 'updated_at' })
  updatedAt!: Date;
}
