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

import com.zhongshu.card.client.type.BookState;
import com.zhongshu.card.client.type.OrganizationUserType;
import com.zhongshu.card.client.type.Sex;
import com.zhongshu.card.server.core.domain.base.SuperMain;
import com.zhongshu.card.server.core.domain.org.Department;
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.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * 学校  通讯录 学生、教师学校
 *
 * @author TRX
 * @date 2024/6/7
 */
@Data
@Document
@AllArgsConstructor
@NoArgsConstructor
@NonLeaked
public class BookInfo extends SuperMain {

    @Schema(description = "类型  学生 、教师")
    OrganizationUserType userType;

    @Schema(description = "姓名")
    private String name;

    @Schema(description = "学号 学生使用")
    private String code;

    @Schema(description = "部门，教师使用")
    @DBRef(lazy = true)
    private Department department;

    @Schema(description = "性别")
    private Sex sex;

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

    @Schema(description = "身份证号")
    private String idCard;

    @Schema(description = "教师 入校时间")
    private Long inSchoolTime;

    @Schema(description = "学生：班级")
    private String className;

    @Schema(description = "学生：入学年份")
    private Long inSchoolYear;

    @Schema(description = "状态")
    private BookState bookState;

    //------------------------关联平台 数据信息 start--------------------
    @Schema(description = "所在学校")
    @DBRef(lazy = true)
    private Organization organization;

    @Schema(description = "关联账号信息")
    @DBRef(lazy = true)
    private UserAccount userAccount;

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

    @Schema(description = "关联的结构用户信息")
    @DBRef(lazy = true)
    private OrganizationUser organizationUser;
}
