import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  ManyToOne,
  JoinColumn,
} from "typeorm"
import { BaseEntity } from "../../common/entities/base.entity"
import { Company } from "../../company/entities/company.entity"

@Entity("activity_types")
export class ActivityType extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number

  @Column({ type: "int", nullable: false })
  company_id: number

  @Column({ type: "varchar", length: 255, nullable: false })
  name: string

  @Column({ type: "text", nullable: true })
  description: string

  @Column({ type: "smallint", nullable: true })
  location_required: number

  @Column({
    type: "smallint",
    nullable: true,
  })
  status: number

  @Column({
    type: "smallint",
    default: 1,
  })
  is_productive: number

  @Column({
    type: "smallint",
    default: 0,
  })
  is_business_task: number

  @Column({
    type: "smallint",
    default: 0,
  })
  is_technical_task: number

  @Column({
    type: "smallint",
    default: 0,
  })
  is_personal_task: number

  @Column({
    type: "int",
    nullable: true,
  })
  maximum_threshold_limit: number

  @ManyToOne(() => Company)
  @JoinColumn({ name: "company_id" })
  company: Company
}
