package com.xinyilu.web.controller.parentactionlogrecord;

import com.xinyilu.common.core.controller.BaseController;
import com.xinyilu.common.core.domain.AjaxResult;
import com.xinyilu.system.domain.applet.AppletParentAndStudentInfo;
import com.xinyilu.system.service.parentactionlogrecord.IParentActionLogRecordService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * 日志记录Controller
 *
 * @author zh
 * @date 2023-04-14
 */
@RestController
@RequestMapping("/kindergartenApplet/actionLogRecord")
public class ParentActionLogRecordController extends BaseController {

    @Resource
    private IParentActionLogRecordService parentActionLogRecordService;

    /**
     * 家长登录记录
     */
    @PostMapping("/loginLogging")
    public AjaxResult loginLogging(@RequestBody AppletParentAndStudentInfo appletParentAndStudentInfo) {
        if (Objects.isNull(appletParentAndStudentInfo)) {
            return AjaxResult.error("记录信息为空");
        }
        return parentActionLogRecordService.loginLogging(appletParentAndStudentInfo);
    }

    /**
     * 处方日志记录
     */
    @PostMapping("/prescriptionLogging")
    public AjaxResult prescriptionLogging(@RequestBody AppletParentAndStudentInfo appletParentAndStudentInfo) {
        if (Objects.isNull(appletParentAndStudentInfo)) {
            return AjaxResult.error("记录信息为空");
        }
        return parentActionLogRecordService.prescriptionLogging(appletParentAndStudentInfo);
    }

    /**
     * 处方视频日志记录
     */
    @PostMapping("/prescriptionVideoLogging")
    public AjaxResult prescriptionVideoLogging(@RequestBody AppletParentAndStudentInfo appletParentAndStudentInfo) {
        if (Objects.isNull(appletParentAndStudentInfo)) {
            return AjaxResult.error("记录信息为空");
        }
        return parentActionLogRecordService.prescriptionVideoLogging(appletParentAndStudentInfo);
    }
}