package cn.novalon.gym.manage.member.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;

/**
 * 会员卡交易流水实体 - 对应 member_card_transactions 表
 * 
 * @author 付嘉
 * @date 2026-05-27
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Table("member_card_transactions")
public class MemberCardTransaction extends BaseEntity {

    // 交易ID
    @Column("member_card_record_id")
    private Long memberCardRecordId;

    // 会员ID
    @Column("member_id")
    private Long memberId;

    // 会员卡ID
    @Column("member_card_id")
    private Long memberCardId;

    // 操作类型：PURCHASE-购买, DEDUCT-扣次/扣费, RENEW-续费, REFUND-退款, EXPIRE-过期
    @Column("operation_type")
    private String operationType;

    // 变动次数
    @Column("change_amount")
    private Integer changeAmount;

    // 变动金额
    @Column("change_balance")
    private Double changeBalance;

    // 变动后剩余次数
    @Column("after_remaining_count")
    private Integer afterRemainingCount;

    // 变动后剩余金额
    @Column("after_remaining_balance")
    private Double afterRemainingBalance;

    // 关联业务类型：GROUP_CLASS-团课, PT_CLASS-私教, CHECK_IN-签到
    @Column("related_biz_type")
    private String relatedBizType;

    // 来源订单ID
    @Column("source_order_id")
    private Long sourceOrderId;

    // 备注
    @Column("remark")
    private String remark;

    // 是否已归档
    @Column("is_archived")
    private Boolean isArchived;

    // 归档时间
    @Column("archived_at")
    private java.time.LocalDateTime archivedAt;

}
