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

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

    @Column()
    sourcePath: string;

    @Column({ nullable: true })
    targetGroupId: string; // If null, creates new group

    @Column({ nullable: true })
    targetGroupName: string; // Used if creating new group

    @Column()
    userId: string;

    @Column({ nullable: true })
    tenantId: string;

    @Column({ nullable: true })
    scheduledAt: Date;

    @Column({ default: 'PENDING' })
    status: 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED';

    @Column({ type: 'text', nullable: true })
    logs: string;

    @Column({ nullable: true })
    embeddingModelId: string;

    @Column({ nullable: true, default: 500 })
    chunkSize: number;

    @Column({ nullable: true, default: 50 })
    chunkOverlap: number;

    @Column({ nullable: true, default: 'fast' })
    mode: string;

    /** When true, sub-directories become sub-categories mirroring the folder hierarchy */
    @Column({ default: false })
    useHierarchy: boolean;

    @CreateDateColumn()
    createdAt: Date;

    @UpdateDateColumn()
    updatedAt: Date;
}
