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

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

import java.time.LocalDate;

@Data
//"会员卡详情")
public class MemberCardVO extends MemberCardDTO {

    //"会员姓名")
    private String memberName;

    //"会员手机号")
    private String memberPhone;

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

    //"卡类型描述")
    private String cardTypeDescription;

    //"卡类型类别")
    private String cardTypeCategory;

    //"卡类型编码")
    private Long cardTypeCode;

    //"剩余有效期（天）")
    private Long remainingValidDays;

    private ScMemberCardTypes cardTypes;//



    /**
     * 计算剩余有效期
     */
    public Long getRemainingValidDays(LocalDate expiryDate) {
        if (expiryDate == null || expiryDate.isBefore(LocalDate.now())) {
            return 0L;
        }
        return java.time.temporal.ChronoUnit.DAYS.between(
            LocalDate.now(), expiryDate
        );
    }
}
