import { Entity, Column, JoinColumn, ManyToOne } from "typeorm";
import { EntityBase } from "./base/Base";
import { CommandSend } from "./CommandSend";

@Entity("commandSendCC")
export class CommandSendCC extends EntityBase {
  @Column({
    nullable: true,
    comment: "ชื่อ",
    length: 255,
    default: null,
  })
  name: string;

  @Column({
    length: 40,
    comment: "คีย์นอก(FK)ของตาราง commandSend",
  })
  commandSendId: string;

  @ManyToOne(() => CommandSend, (commandSend) => commandSend.commandSendCCs)
  @JoinColumn({ name: "commandSendId" })
  commandSend: CommandSend;
}

export class CreateCommandSendCC {
  @Column()
  name: string;
}

export type UpdateCommandSendCC = Partial<CreateCommandSendCC>;
