package com.ruoyi.school.member.domain.resp;

import com.ruoyi.school.member.domain.ScMemberCard;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
//"会员卡信息")
public class MemberCardDTO {

    //"卡ID")
    private Long id;

    //"卡号")
    private String cardNo;

    //"会员ID")
    private Long memberId;


    //"卡类型ID")
    private Long cardTypeId;


    //"卡类型名称")
    private String cardTypeName;

    //"状态")
    private String status;

    //"状态描述")
    private String statusDesc;

    //"剩余次数")
    private BigDecimal remainingCount;

    //"剩余天数")
    private Integer remainingDays;

    //"总次数")
    private BigDecimal totalCount;

    //"总天数")
    private Integer totalDays;

    private BigDecimal totalFee;

    private BigDecimal remainingTotalFee;

    //"激活日期")
    private LocalDate activationDate;

    //"到期日期")
    private LocalDate expiryDate;

    //"购买日期")
    private LocalDateTime purchaseDate;

    //"购买价格")
    private BigDecimal price;

    //"支付方式")
    private String accountId;

    //"订单号")
    private String orderNo;

    //"是否有效")
    private Boolean valid;

    //"是否过期")
    private Boolean expired;

    //"是否可用")
    private Boolean available;

    //"是否可以续费")
    private Boolean canRenew;

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

    /**
     * 原价
     */
    private BigDecimal originalTotalFee;
    /**
     * 销售员工
     */
    private Long saleStaffId;

    /**
     * 经办校区
     */
    private Long handleDeptId;

    private String chargeType;

    private int pageNum;
    private int pageSize;
    private String startDate;
    private String endDate;

    /**
     * 从实体转换为DTO
     */
    public static MemberCardDTO fromEntity(ScMemberCard card) {
        if (card == null) {
            return null;
        }

        MemberCardDTO dto = new MemberCardDTO();
        dto.setId(card.getId());
        dto.setCardNo(card.getCardNo());
        dto.setMemberId(card.getMemberId());
        dto.setCardTypeId(card.getCardTypeId());
        dto.setStatus(card.getCardStatus().name());
        dto.setStatusDesc(card.getCardStatus().getDescription());
        dto.setRemainingCount(card.getRemainingCount());
        dto.setRemainingDays(card.getRemainingDays());
        dto.setTotalCount(card.getTotalCount());
        dto.setTotalDays(card.getTotalDays());
        dto.setActivationDate(card.getActivationDate());
        dto.setExpiryDate(card.getExpiryDate());
        dto.setPurchaseDate(card.getPurchaseDate());
        dto.setPrice(card.getPrice());
        dto.setValid(card.isValid());
        dto.setExpired(card.isExpired());
        dto.setAvailable(card.isAvailable());
        dto.setCanRenew(card.canRenew());

        return dto;
    }
}
