import { BaseEntity } from "@/abstrClass/BaseEntity";
import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  OneToOne,
  JoinColumn,
} from "typeorm";
import DeceasedRetail from "./DeceasedRetail";

@Entity("payment_records")
export class PaymentRecord extends BaseEntity {
  @Column({
    type: "datetime",
    name: "checkout_date",
    comment: "结账日期",
    default: () => "CURRENT_TIMESTAMP",
  })
  checkoutDate: Date;

  @Column({ type: "varchar", length: 50, comment: "经办人" })
  handler: string;

  @Column({
    type: "datetime",
    name: "settlement_date",
    comment: "结算日期",
    default: () => "CURRENT_TIMESTAMP",
  })
  settlementDate: Date;

  @Column({
    type: "decimal",
    precision: 12,
    scale: 2,
    name: "cash_amount",
    comment: "现金金额",
  })
  cashAmount: number;

  @Column({
    type: "decimal",
    precision: 12,
    comment: "银联支付金额",
    scale: 2,
    name: "union_pay_amount",
  })
  unionPayAmount: number;

  @Column({
    type: "decimal",
    precision: 12,
    comment: "刷卡金额",
    scale: 2,
    name: "card_amount",
  })
  cardAmount: number;

  @Column({
    type: "decimal",
    precision: 12,
    scale: 2,
    comment: "对公转账金额",
    name: "public_transfer_amount",
  })
  publicTransferAmount: number;

  @Column({
    type: "decimal",
    precision: 12,
    scale: 2,
    comment: "车间支付",
    name: "workshop_payment",
  })
  workshopPayment: number;

  @Column({
    type: "int",
    comment: "零售单子ID",
    default: 0,
    name: "deceased_retail_id",
  })
  deceasedRetailId: number;

  @Column({
    type: "int",
    comment: "无零售单子ID",
    name: "no_deceased_retail_id",
    default: 0,
  })
  noDeceasedRetailId: number;

  @Column({
    type: "int",
    comment: "单子ID",
    name: "retail_id",
    default: 0,
  })
  retailId: number;
}

export default PaymentRecord;
