package com.hz.pm.api.external.controller;

import com.hz.pm.api.user.manage.SyncMhUserOrgManage;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * <p>
 * MhSyncController
 * </p>
 *
 * @author WendyYang
 * @since 09:56 2023/12/22
 */
@Api(hidden = true)
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/mh/sync")
public class MhSyncController {

    private final SyncMhUserOrgManage syncMhUserOrgManage;

    @GetMapping("/users")
    public void getUsers(@RequestParam(value = "syncTime", required = false)
                         @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime syncTime) {
        syncMhUserOrgManage.syncUsers(syncTime);
    }

    @GetMapping("/units")
    public void getUnits() {
        syncMhUserOrgManage.syncUnits();
    }

    @GetMapping("/experts")
    public void getExperts(@RequestParam(value = "syncTime", required = false)
                           @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime syncTime) {
        syncMhUserOrgManage.syncExperts(syncTime);
    }

    @GetMapping("/company")
    public void getExperts() {
        syncMhUserOrgManage.syncCompany();
    }

}
