import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from "typeorm";

/**
 * 回收物品订单
 */
@Entity("t_recycle_order")
export class RecycleOrderEntity extends BaseEntity {
    @Index({ unique: true })
    @Column({ comment: "订单编号" })
    orderNo: string;

    @Column({ comment: "订单类型", dict: ['现场', '预约', '大屏', '活动'], default: '现场' })
    orderType: string;

    @Index()
    @Column({ comment: "用户ID" })
    campusUserId: string;

    campusUserName: string;

    @Index()
    @Column({ comment: '学校ID', nullable: true })   // 使用归属部门，这里建议选顶层学校
    departmentId: number;

    departmentName: string;

    @Index()
    @Column({ comment: "站点ID", nullable: true})
    siteId: string;

    @Index()
    @Column({ comment: "分拣员ID", nullable: true, default: 0 })
    sorterId: string;

    @Index()
    @Column({ comment: "预约ID", nullable: true})
    appointmentId: number;

    @Column({ comment: '状态', dict: ['待处理', '进行中', '已完成', '已取消'], default: '已完成', })
    status: string;

    @Column({ comment: '总重量', type: 'decimal', precision: 10, scale: 2, default: 0, })
    totalWeight: number;

    @Column({ comment: '总金额', type: 'decimal', precision: 10, scale: 2, default: 0, })
    totalAmount: number;

    @Column({ comment: '总碳积分', type: 'decimal', precision: 10, scale: 2, default: 0, })
    totalCarbonPoint: number;

    @Column({ comment: '完成时间', nullable: true })
    finishTime: Date;


}