package com.zhongshu.card.server.core.domain.school;

import com.zhongshu.card.client.type.CardCancelState;
import com.zhongshu.card.client.type.school.CardState;
import com.zhongshu.card.client.type.school.CardType;
import com.zhongshu.card.server.core.domain.base.SuperMain;
import com.zhongshu.card.server.core.domain.org.Organization;
import com.zhongshu.card.server.core.domain.org.OrganizationUser;
import com.zhongshu.card.server.core.domain.org.UserAccount;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.checkerframework.common.aliasing.qual.NonLeaked;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * @author TRX
 * @date 2024/6/13
 */
@Data
@Document
@AllArgsConstructor
@NoArgsConstructor
@NonLeaked
public class CardInfo extends SuperMain {

    @Schema(description = "学校oid")
    private String schoolOid;

    @Schema(description = "卡片名称")
    private String name;

    @Schema(description = "卡片类型")
    private CardType cardType;

    @Indexed
    @Schema(description = "卡片号码,唯一标识, 卡号")
    private String code;

    @Schema(description = "卡片状态")
    private CardState cardState;

    @Schema(description = "是否作废")
    private Boolean isCanceled = Boolean.FALSE;

    @Schema(description = "作废时间")
    private Long cancelTime;

    @Schema(description = "作废时间")
    private String cancelUserId;

    @Schema(description = "所属用户")
    @DBRef(lazy = true)
    private UserAccount userAccount;

    @Schema(description = "所属用户UserId")
    private String userId;

    @Schema(description = "用户名称")
    private String userName;

    @Schema(description = "电话")
    private String phone;

    @Schema(description = "所属机构")
    @DBRef(lazy = true)
    private Organization organization;

    @Schema(description = "校园名称")
    private String orgName;

    @Schema(description = "企业用户")
    @DBRef(lazy = true)
    private OrganizationUser organizationUser;
}
