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

@Entity('module_store')
export class ModuleStore {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ type: 'varchar', unique: true })
  module_slug: string;

  @Column({ type: 'varchar' })
  module_name: string;

  @Column({ type: 'text', nullable: true })
  description: string | null;

  @Column({ type: 'text', nullable: true })
  long_description: string | null;

  @Column({ type: 'decimal', precision: 10, scale: 2, default: 0 })
  price: number;

  @Column({ type: 'varchar', default: 'one_time' })
  price_type: string;

  @Column({ type: 'decimal', precision: 10, scale: 2, nullable: true })
  monthly_price: number | null;

  @Column({ type: 'varchar', default: '1.0.0' })
  version: string;

  @Column({ type: 'text', nullable: true })
  download_path: string | null;

  @Column({ type: 'text', nullable: true })
  thumbnail_url: string | null;

  @Column({ type: 'text', array: true, nullable: true, default: () => "'{}'" })
  screenshots: string[] | null;

  @Column({ type: 'varchar', nullable: true })
  category: string | null;

  @Column({ type: 'boolean', default: true })
  is_active: boolean;

  @Column({ type: 'timestamptz', default: () => 'NOW()' })
  created_at: Date;

  @Column({ type: 'timestamptz', default: () => 'NOW()' })
  updated_at: Date;
}
