/*
 *    Copyright (c) 2018-2025, hnqz All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: hnqz
 */

package com.qunzhixinxi.hnqz.admin.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.qunzhixinxi.hnqz.admin.enums.CategoryEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.DecimalMin;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 积分包结算信息
 *
 * @author pigx code generator
 * @date 2021-01-26 15:44:49
 */
@Data
@TableName("wm_score_package_settle_note")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "积分包结算信息")
public class WmScorePackageSettleNote extends Model<WmScorePackageSettleNote> {

	private static final long serialVersionUID = -8023429988222929988L;

	/**
	 * id
	 */
	@TableId
	@ApiModelProperty(value = "id")
	private Integer id;

	/**
	 * 积分包id
	 */
	@ApiModelProperty(value = "积分包id")
	private String packageId;

	/**
	 * 积分包名称
	 */
	@TableField(exist = false)
	@ApiModelProperty(value = "积分包名称")
	private String packageName;

	/**
	 * 积分包状态id
	 */
	@ApiModelProperty(value = "积分包状态id")
	private String packageStatusId;

	/**
	 * 任务id
	 */
	@ApiModelProperty(value = "任务id")
	private String taskId;

	/**
	 * 结算金额
	 */
	@ApiModelProperty(value = "结算金额")
	@DecimalMin("0")
	private BigDecimal settleAmount;

	/**
	 * 用户id
	 */
	@ApiModelProperty(value = "用户id")
	private String userId;

	/**
	 * 发票类型
	 */
	@ApiModelProperty(value = "发票类型")
	private Integer invoiceType;

	/**
	 * 结算流水号
	 */
	@ApiModelProperty(value = "结算流水号")
	private String settleNo;

	/**
	 * 折扣
	 */
	@ApiModelProperty(value = "折扣")
	private BigDecimal discount;

	/**
	 * 结算信息状态
	 */
	@ApiModelProperty(value = "结算信息状态")
	private Integer settleNoteStatus;

	/**
	 * 发票类目
	 */
	@ApiModelProperty(value = "发票类目")
	private String categoryName;

	/**
	 * 备注
	 */
	private String remark;

	/**
	 * 创建时间
	 */
	private LocalDateTime createTime;

	/**
	 * 更新时间
	 */
	private LocalDateTime updateTime;

	/**
	 * 提交时间
	 */
	private LocalDateTime subTime;

	/**
	 * 提交到零工平台的时间
	 */
	private LocalDateTime subToGigTime;

	/**
	 * 回调时间
	 */
	private LocalDateTime notifyTime;

	/**
	 * 税邦云流水号
	 */
	private String streamId;

	/**
	 * 身份证号
	 */
	private String idCardNumber;

	/**
	 * 结算类型
	 */
	private String subType;

	/**
	 * 真实名称
	 */
	@TableField(exist = false)
	private String realName;

	@TableField(exist = false)
	private String idStr;

	/**
	 * 提交时间-起始（用于范围查询）
	 */
	@TableField(exist = false)
	private LocalDateTime startSubTime;

	/**
	 * 提交时间-结束（用于范围查询）
	 */
	@TableField(exist = false)
	private LocalDateTime endSubTime;

	/**
	 * 获取发票类目
	 * @Modify: start
	 * @Version: 2021.4.16
	 * @Author: ryz
	 * @Date: 2021/4/22
	 */
	public String toCategoryName() {

		if (CategoryEnum.CATEGORY_1.getCode().equals(invoiceType)) {
			return CategoryEnum.CATEGORY_1.getDesc();
		} else if (CategoryEnum.CATEGORY_2.getCode().equals(invoiceType)) {
			return CategoryEnum.CATEGORY_2.getDesc();
		} else if (CategoryEnum.CATEGORY_3.getCode().equals(invoiceType)) {
			return CategoryEnum.CATEGORY_3.getDesc();
		} else if (CategoryEnum.CATEGORY_4.getCode().equals(invoiceType)) {
			return CategoryEnum.CATEGORY_4.getDesc();
		}

		return "";
	}
}
