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

import com.github.microservice.models.type.DeviceType;
import com.zhongshu.card.client.type.DataState;
import com.zhongshu.card.client.type.OnLineState;
import com.zhongshu.card.client.type.PaymentModeType;
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.school.Area;
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/7/2
 */
@Data
@Document
@AllArgsConstructor
@NoArgsConstructor
@NonLeaked
public class DeviceBind extends SuperMain {

    @Schema(description = "设备信息")
    @DBRef(lazy = true)
    private DeviceInfo deviceInfo;

    @Schema(description = "设备ID、设备号")
    private String deviceId;

    @Schema(description = "设备名称")
    private String deviceName;

    @Schema(description = "设备类型，如 消费机 门禁机")
    private DeviceType deviceType;

    @Schema(description = "关联的项目code")
    private String projectInfoCode;

    @Schema(description = "网关")
    private String gateWayId;

    @Schema(description = "是否在线")
    private OnLineState onLineState = OnLineState.OnLine;

    @Schema(description = "数据状态")
    private DataState state = DataState.Enable;

    @Schema(description = "最上线时间")
    private Long lastOnlineTime;

    @Schema(description = "学校信息")
    @DBRef(lazy = true)
    private Organization schoolInfo;

    @Schema(description = "学校信息Oid")
    private String schoolInfoOid;

    @Schema(description = "商户信息")
    @DBRef(lazy = true)
    private Organization shopInfo;

    @Schema(description = "商户Oid")
    private String shopInfoOid;

    @Schema(description = "区域信息")
    @DBRef(lazy = true)
    private Area area;

    @Schema(description = "付费模式")
    private PaymentModeType paymentModeType;

    @Schema(description = "收款账号")
    private String receivingAccount;
}
