package cn.iocoder.yudao.module.staff.controller.app;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.staff.service.ApiAppLoginService;
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.security.PermitAll;

/**
 * 员工APP端登录通用接口
 * @author vinjor-M
 * @date 14:04 2024/10/16
**/
@RestController
@RequestMapping("/company/staff")
@Tag(name = "员工APP端登录通用接口")
public class ApiAppLoginController {
    @Autowired
    private ApiAppLoginService apiAppLoginService;
    @Autowired
    private CompanyStaffService companyStaffService;

    /**
     * 登录获取验证码
     * @author vinjor-M
     * @date 14:06 2024/10/16
     * @param phone 手机号
     * @param sysCode 系统标识
     * @return cn.iocoder.yudao.framework.common.pojo.CommonResult
    **/
    @PostMapping("/loginSmsCode")
    public CommonResult<?> loginSmsCode(String phone,String sysCode) {
        return apiAppLoginService.loginSmsCode(phone,sysCode);
    }

    /**
     * 客户查我的邀请人
     * @author vinjor-M
     * @date 10:40 2024/11/6
     * @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
    **/
    @GetMapping("/getMyAdviser")
    @TenantIgnore
    public CommonResult<?> getMyAdviser(Long tenantId,String sysCode) {
        return CommonResult.success(companyStaffService.getMyAdviser(tenantId,sysCode));
    }
}
