package com.njzscloud.supervisory.order.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.njzscloud.common.mp.support.handler.j.JsonTypeHandler;
import com.njzscloud.supervisory.biz.constant.BizObj;
import com.njzscloud.supervisory.expense.contant.GoodsScope;
import com.njzscloud.supervisory.expense.contant.Scope;
import com.njzscloud.supervisory.expense.contant.StationsScope;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 订单付费项
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@TableName("order_expense_items")
public class OrderExpenseItemsEntity {

    /**
     * Id
     */
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 付费项类型; 字典代码：expense_item_category
     */
    private String expenseItemCategory;

    /**
     * 订单 Id
     */
    private Long orderId;

    /**
     * 源付费项 Id（来源：order_goods.id 或 expense_items_config.id）
     */
    private Long originExpenseItemId;

    /**
     * 付费项名称
     */
    private String expenseItemName;

    /**
     * 单价; 单位：元
     */
    private BigDecimal unitPrice;

    /**
     * 单位; 字典代码：unit
     */
    private String unit;

    /**
     * 计费策略; 字典代码：money_strategy
     */
    private String moneyStrategy;

    /**
     * 计费配置 Id
     */
    private Long moneyConfigId;

    /**
     * 适用范围; 适用范围; all -->所有客户 customer_type-->指定客户类型 customer -->指定客户
     */
    private Scope scope;

    /**
     * 客户类型
     */
    private BizObj bizObj;

    /**
     * 公司ids
     */
    @TableField(typeHandler = JsonTypeHandler.class)
    private List<String> companyIds;

    /**
     * 产品范围;字典代码：goods_scope all ->所有产品  goods ->指定产品
     */
    private GoodsScope goodsScope;

    /**
     * 产品ids
     */
    @TableField(typeHandler = JsonTypeHandler.class)
    private List<String> goodsIds;

    /**
     * 站点范围;字典代码：station_scope all -->所有站点  stations -->指定站点
     */
    private StationsScope stationScope;

    /**
     * 站点ids
     */
    @TableField(typeHandler = JsonTypeHandler.class)
    private List<String> stationIds;

    /**
     * 计费类型 fixed -> 固定计费 elasticity -> 弹性计费
     */
    private String billingType;

    /**
     * 基础磅重; 单位：吨
     */
    private BigDecimal basicWeight;

    /**
     * 基础单价; 单位：元
     */
    private BigDecimal basicPrice;

    /**
     * 每档磅重; 单位：吨
     */
    private BigDecimal everyWeight;

    /**
     * 每档单价; 单位：元
     */
    private BigDecimal everyPrice;

    /**
     * 税率
     */
    private BigDecimal taxRate;

    /**
     * 数量
     */
    private Integer quantity;

    /**
     * 优惠金额; 有正负
     */
    private BigDecimal discountMoney;

    /**
     * 手动修正金额; 有正负
     */
    private BigDecimal reviseMoney;

    /**
     * 结算金额; 正
     */
    private BigDecimal settleMoney;

    /**
     * 总金额; 单位：元
     */
    private BigDecimal totalMoney;

    @TableField(fill = FieldFill.INSERT)
    private Long creatorId;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long modifierId;

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime modifyTime;

    @TableLogic
    private Boolean deleted;

    /**
     * 改价后金额; 单位：元
     */
    private BigDecimal changeMoney;

}


