package com.css.txw.sso.controller.session;

import com.css.txw.sso.api.yhxx.SwitchSessionApi;
import com.css.txw.sso.pojo.yhxx.SwitchCompanyResDTO;
import com.css.txw.sso.service.session.SwitchSessionService;
import com.css.ggzc.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@Tag(name = "切换session信息")
@RestController
@RequestMapping("/switchSession")
@Slf4j
public class SwitchSessionController implements SwitchSessionApi {

    @Resource
    private SwitchSessionService switchSessionService;


    @PostMapping("/company")
    @Operation(summary = "切换机构")
    @Override
    public CommonResult<SwitchCompanyResDTO> switchCompany(@RequestParam("token")String token,@RequestParam("jguuid")String jguuid) {
        return CommonResult.success(switchSessionService.switchCompany(token,jguuid));
    }

    @PostMapping("/addCompany")
    @Operation(summary = "新增机构")
    @Override
    public CommonResult<String> addCompany(@RequestBody SwitchCompanyResDTO resDTO) {
        return CommonResult.success(switchSessionService.addCompany(resDTO));
    }

}
