/**
 * TeacherReport Entity
 *
 * Represents metadata of reports generated by teachers.
 * Maps to: social_features.teacher_reports
 *
 * @see apps/database/ddl/schemas/social_features/tables/08-teacher_reports.sql
 */

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

/**
 * Entity for teacher-generated reports metadata
 */
@Entity({ name: 'teacher_reports', schema: 'social_features' })
export class TeacherReport {
  @PrimaryGeneratedColumn('uuid')
    id!: string;

  @Column({ name: 'teacher_id', type: 'uuid' })
    teacherId!: string;

  @Column({ name: 'classroom_id', type: 'uuid', nullable: true })
    classroomId!: string | null;

  @Column({ name: 'tenant_id', type: 'uuid' })
    tenantId!: string;

  @Column({ name: 'report_name', length: 255 })
    reportName!: string;

  @Column({ name: 'report_type', length: 50 })
    reportType!: string;

  @Column({ name: 'report_format', length: 10 })
    reportFormat!: string;

  @Column({ name: 'student_count', type: 'int', default: 0 })
    studentCount!: number;

  @Column({ name: 'period_start', type: 'date', nullable: true })
    periodStart!: Date | null;

  @Column({ name: 'period_end', type: 'date', nullable: true })
    periodEnd!: Date | null;

  @Column({ name: 'file_path', type: 'text', nullable: true })
    filePath!: string | null;

  @Column({ name: 'file_size_bytes', type: 'bigint', nullable: true })
    fileSizeBytes!: number | null;

  @Column({ name: 'generated_at', type: 'timestamptz', default: () => 'NOW()' })
    generatedAt!: Date;

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

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