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

@Entity('modules')
export class Module {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ type: 'varchar', length: 100, unique: true })
  slug: string;

  @Column({ type: 'varchar', length: 200 })
  name: string;

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

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

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

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

  @Column({ type: 'jsonb', nullable: true })
  screenshots: any | null;

  @Column({ type: 'jsonb', nullable: true })
  features: any | null;

  @Column({ type: 'varchar', length: 20 })
  version: string;

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

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