/*
 * Copyright (c) 京北方信息技术股份有限公司 Corporation 2021 . All rights reserved.
 *
 */
package net.northking.cctp.saas.api.tenant;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.northking.cctp.common.http.ResultWrapper;
import net.northking.cctp.saas.api.tenant.service.SaaSTenantApiService;
import net.northking.cctp.saas.dto.tenant.SaaSTenantDetailDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 租户 => Restful 类型 HTTP/HTTPS 接口
 *
 * @author maven-cctp-plugin
 * @since 1.0
 */
@Api(tags = "租户")
@RequestMapping("/v1/tenants")
@RestController
public class SaaSTenantRestfulCtrl {
    /**
     * 日志
     */
    private final static Logger logger = LoggerFactory.getLogger(SaaSTenantRestfulCtrl.class);

    @Autowired
    private SaaSTenantApiService apiService;

    /**
     * Restful接口-get： 获取租户
     *
     * @param uuid 数据库主键
     * @return 接口数据传输对象
     */
    @ApiOperation(value = "获取：租户")
    @GetMapping(
            value = "/{uuid}",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResultWrapper<SaaSTenantDetailDto> findByPK(
            @PathVariable("uuid") String uuid) {
        ResultWrapper<SaaSTenantDetailDto> wrapper = new ResultWrapper<>();
        SaaSTenantDetailDto user = apiService.findByPK(uuid);
        return wrapper.success(user);
    }
}
