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

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

  @Column({ type: 'varchar', length: 200 }) title: string;
  @Column({ type: 'varchar', length: 200, nullable: true }) titleNe: string | null;
  @Column({ type: 'text', nullable: true }) description: string | null;
  @Column({ type: 'text', nullable: true }) descriptionNe: string | null;

  @Column({ type: 'varchar', length: 20, default: 'pending' })
  status: 'pending' | 'in_progress' | 'done' | 'cancelled';

  @Column({ type: 'varchar', length: 10, default: 'medium' })
  priority: 'low' | 'medium' | 'high' | 'urgent';

  @Column({ type: 'varchar', length: 100, nullable: true }) category: string | null;
  @Column({ type: 'date', nullable: true }) dueDate: string | null;
  @Column({ type: 'date', nullable: true }) completedDate: string | null;

  @Column({ type: 'varchar', nullable: true }) assignedToId: string | null;
  @Column({ type: 'varchar', length: 200, nullable: true }) assignedToName: string | null;
  @Column({ type: 'varchar', nullable: true }) officeId: string | null;
  @Column({ type: 'varchar', length: 200, nullable: true }) createdByName: string | null;
  @Column({ type: 'varchar', nullable: true }) createdById: string | null;

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

  @CreateDateColumn() createdAt: Date;
  @UpdateDateColumn() updatedAt: Date;
  @DeleteDateColumn() deletedAt: Date | null;
}
