package com.erp.print.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.Builder;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.time.LocalDateTime;
import java.math.BigDecimal;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("print_task")
public class PrintTask {

    @TableId(type = IdType.AUTO)
    private Long id;

    /** 任务编号 */
    private String taskNo;

    /** 关联单据类型: order/invoice/delivery */
    private String documentType;

    /** 关联单据ID */
    private Long documentId;

    /** 关联单据编号 */
    private String documentNo;

    /** 模板ID */
    private Long templateId;

    /** 模板名称 */
    private String templateName;

    /** 打印机ID */
    private Long printerId;

    /** 打印机名称 */
    private String printerName;

    /** 打印份数 */
    private Integer copies;

    /** 打印状态: pending/processing/completed/failed */
    private String taskStatus;

    /** 优先级: 1-低 2-中 3-高 */
    private Integer priority;

    /** 打印参数(JSON格式) */
    private String printParams;

    /** 失败原因 */
    private String errorMessage;

    /** 重试次数 */
    private Integer retryCount;

    /** 最大重试次数 */
    private Integer maxRetries;

    /** 用户ID */
    private Long userId;

    /** 用户名称 */
    private String userName;

    /** 租户ID */
    private Long tenantId;

    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime printedAt;

    @TableLogic
    private Integer deleted;
}
