package jnpf.model.cultivate.vo.teaching;

import jnpf.entity.cultivate.TeachingRecord;
import jnpf.entity.cultivate.TeachingSkill;
import jnpf.model.cultivate.v2.teaching.model.V2Attachment;
import jnpf.util.DateDetail;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.List;

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RecordInfoVo {
    /**
     * 数据id
     */
    private String id;
    /**
     * 技能点id
     */
    private String skillId;
    /**
     * 技能点名称
     */
    private String skillName;
    /**
     * 技能点描述
     */
    private String skillDesc;
    /**
     * 日期(yyyy-MM-dd)
     */
    private String date;
    /**
     * 练习视频地址[暂弃]
     */
    private String videoPath;

    /**
     * 练习视频封面[暂弃]
     */
    private String videoCover;

    /** 图片视频集合 */
    private List<V2Attachment> attachments;

    /**
     * 视频类型(1-竖屏播放, 2-横屏播放)[暂弃]
     */
    private Integer videoActionType;

    /**
     * 练习时长(秒)[暂弃]
     */
    private BigDecimal videoDuration;

    /** 备注 */
    private String remark;

    public static RecordInfoVo convert(TeachingRecord teachingRecord, TeachingSkill teachingSkill) {
        return RecordInfoVo.builder()
                .id(teachingRecord.getId())
                .skillId(teachingRecord.getSkillId())
                .skillName(teachingSkill.getName())
                .skillDesc(teachingSkill.getDescription())
                .date(DateDetail.getDate2Str(teachingRecord.getDate(), DateDetail.DF))
                .remark(teachingRecord.getRemark())
                .build();
    }
}