package com.yh.saas.plugin.operation.controller;

import com.winsea.svc.base.base.entity.CommonTenant;

import com.yh.saas.plugin.operation.service.IVisitorRegisterService;
import org.springframework.beans.factory.annotation.Autowired;
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.validation.Valid;
import java.io.IOException;

/**
 * <p>
 * 前台客户注册
 * </p>
 *
 * @author Wangs
 * @since 2020年2月25日14:31:45
 */

@RestController
@RequestMapping("/visitorRegister")
public class VisitorRegisterController {

    @Autowired
    private IVisitorRegisterService visitorRegisterService;

    /**
     * 前台创建新租户
     *
     * @param tenant 租户信息
     * @return 租户ID
     */
    @PostMapping("/api/create")
    public String create(@RequestBody @Valid CommonTenant tenant) throws IOException {
        String tenantId = visitorRegisterService.createNewVisitor(tenant);
        return tenantId;
    }

}
