import {
  Table,
  Model,
  Column,
  DataType,
  ForeignKey,
  BelongsTo,
} from 'sequelize-typescript';
import { CustomerBusinessModel } from './customer-business.entity';

@Table({ tableName: 'business_Contact', createdAt: false, updatedAt: false })
export class BusinessContactModel extends Model {
  @Column({ primaryKey: true, allowNull: false, type: DataType.STRING(30) })
  ContactId: string;

  @ForeignKey(() => CustomerBusinessModel)
  @Column({ allowNull: false, type: DataType.STRING(30) })
  CustomerId: string;

  @Column({ allowNull: false, type: DataType.STRING(200) })
  Name: string;

  @Column({ type: DataType.STRING(50) })
  Email: string;

  @Column({ allowNull: false, type: DataType.STRING(20) })
  ContactNo: string;

  @Column({ type: DataType.STRING(30) })
  Position: string;

  @Column({ allowNull: false, type: DataType.STRING(1) })
  IsMainYN: string;

  @BelongsTo(() => CustomerBusinessModel)
  Business: CustomerBusinessModel;
}
