import { Entity, Column, PrimaryColumn, VersionColumn } from 'typeorm';

@Entity('daily_active_stats')
export class DailyActiveStats {
  @PrimaryColumn({ type: 'date' })
  day: string;

  @Column({ name: 'dau_count', type: 'int', default: 0 })
  dauCount: number;

  @Column({ name: 'dau_by_platform', type: 'jsonb', default: '{}' })
  dauByPlatform: Record<string, number>;

  @Column({ name: 'dau_by_region', type: 'jsonb', default: '{}' })
  dauByRegion: Record<string, number>;

  @Column({ name: 'calculated_at', type: 'timestamptz' })
  calculatedAt: Date;

  @VersionColumn({ default: 1 })
  version: number;
}
