package com.storlead.wx.pojo.vo;

import com.alibaba.fastjson.JSON;
//import com.storlead.centre.entity.AttendanceSignRecordEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.CollectionUtils;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * @program: storlead-centre-platform
 * @description:
 * @author: chenkq
 * @create: 2026-01-04 15:23
 */
@Data
public class CheckinDataBO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "用户唯一标识（企微 / 系统用户ID）",example = "ChenKaiQiang")
    private String userId;

    @ApiModelProperty(value = "考勤组名称",example = "领存技术Attendance")
    private String groupName;

    @ApiModelProperty(
            value = "打卡类型（字典）",
            notes = "CHECKIN_TYPE：\n" +
                    "ON_DUTY - 上班打卡\n" +
                    "OFF_DUTY - 下班打卡",
            example = "上班打卡"
    )
    private String checkinType;

    @ApiModelProperty(
            value = "异常类型（字典）",
            notes = "EXCEPTION_TYPE：\n" +
                    "LATE - 迟到\n" +
                    "EARLY - 早退\n" +
                    "ABSENT - 缺卡\n" +
                    "NORMAL - 正常（为空或NORMAL）",
            example = ""
    )
    private String exceptionType;

    @ApiModelProperty(
            value = "打卡时间（Unix时间戳，秒）",
            example = "1767490002"
    )
    private Long checkinTime;

    @ApiModelProperty(
            value = "打卡地点名称",
            example = "领存技术"
    )
    private String locationTitle;

    @ApiModelProperty(
            value = "打卡地点详细地址",
            example = "广东省深圳市宝安区新安街道兴业路金利通金融中心"
    )
    private String locationDetail;

    @ApiModelProperty(
            value = "WiFi 名称",
            notes = "未连接公司WiFi时通常为固定文案",
            example = "未连接到公司指定WiFi"
    )
    private String wifiName;

    @ApiModelProperty(
            value = "WiFi MAC 地址",
            example = "00:dd:b6:e5:98:5a"
    )
    private String wifiMac;

    @ApiModelProperty(value = "打卡备注说明",example = "")
    private String notes;

    @ApiModelProperty(value = "打卡照片/视频媒体ID列表",example = "[]")
    private List<String> mediaIds;

    @ApiModelProperty(
            value = "位置打卡地点纬度，是实际纬度的1000000倍，与腾讯地图一致采用GCJ-02坐标系统标准",
            example = "22551739"
    )
    private String lat;

    @ApiModelProperty(value = "位置打卡地点纬度，是实际纬度的1000000倍，与腾讯地图一致采用GCJ-02坐标系统标准",
            example = "113879515")
    private String lng;

    @ApiModelProperty(value = "设备唯一标识",example = "1f758b0ea9f2b33a"    )
    private String deviceId;

    @ApiModelProperty(value = "考勤组ID",
            example = "1")
    private Long groupId;

//    public static List<AttendanceSignRecordEntity> appPageInfoListToAppPageTreeVoList(List<CheckinDataBo> vals) {
//        if (CollectionUtils.isEmpty(vals)) {
//            return null;
//        }
//        List<AttendanceSignRecordEntity> departmentTrees = vals.stream().map(CheckinDataBo::appPageInfoListToAppPageTreeVo).filter(obj -> !Objects.isNull(obj)).collect(Collectors.toList());
//        return departmentTrees;
//    }
//
//    public static AttendanceSignRecordEntity  appPageInfoListToAppPageTreeVo(CheckinDataBo bo) {
//        if (null == bo) {
//            return null;
//        }
//        AttendanceSignRecordEntity entity = new AttendanceSignRecordEntity();
//
//        entity.setWxUserId(bo.getUserId());
//        entity.setGroupId(bo.getGroupId());
//        entity.setGroupName(bo.getGroupName());
//        entity.setCheckinType(bo.getCheckinType());
//        entity.setExceptionType(bo.getExceptionType());
//        entity.setCheckinTime(bo.getCheckinTime());
//        entity.setLocationTitle(bo.getLocationTitle());
//        entity.setLocationDetail(bo.getLocationDetail());
//        entity.setWifiName(bo.getWifiName());
//        entity.setWifiMac(bo.getWifiMac());
//        entity.setLatitude(bo.getLat());
//        entity.setLongitude(bo.getLat());
//        entity.setDeviceId(bo.getDeviceId());
//        // 媒体ID列表（如果是 JSON 存库，这里可序列化）
//        if (!CollectionUtils.isEmpty(bo.getMediaIds())) {
//            entity.setMediaIds(JSON.toJSONString(bo.getMediaIds()));
//        }
//        return entity;
//    }
}
