package com.bocloud.ims.booter.controller.resource.azure.account;

import com.bocloud.common.annotations.Log;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.model.Pager;
import com.bocloud.common.model.RequestContext;
import com.bocloud.common.utils.Common;
import com.bocloud.ims.entity.resource.azure.account.BatchAccount;
import com.bocloud.ims.interfaces.resource.azure.account.BatchAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * @Company: 博云 www.bocloud.com
 * @ClassName: BatchAccountController
 * @Description:
 * @author: zhenpingLi/李振平
 * @date: 2020/7/24 14:15
 */
@Api(value = "batchAccount", tags = "batchAccount管理")
@RestController
@RequestMapping("/v1/batch/accounts")
public class BatchAccountController {

    @Autowired
    private BatchAccountService service;

    /**
     * 查询列表
     *
     * @param pager
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "batchAccount列表", httpMethod = "GET")
    @Log(module = BoCloudService.IMS, target = "batchAccount", operation = "batchAccount列表")
    @GetMapping
    public BocloudResult list(Pager pager,
                              @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.list(pager, context);
    }


    /**
     * 查询详情
     *
     * @param id
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "batchAccount详情", httpMethod = "GET")
    @Log(module = BoCloudService.IMS, target = "batchAccount", operation = "batchAccount详情")
    @GetMapping("/{id}")
    public BocloudResult detail(@PathVariable(value = Common.ID) Long id,
                                @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.detail(id, context);
    }


    /**
     * 创建
     *
     * @param entityParams
     * @param context
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "batchAccount创建", httpMethod = "POST")
    @Log(module = BoCloudService.IMS, target = "batchAccount", operation = "创建batchAccount")
    @PostMapping
    public BocloudResult create(@RequestBody BatchAccount entityParams,
                                @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.create(entityParams, context);
    }

    /**
     * 修改
     *
     * @param entityParams
     * @param context
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "batchAccount更新", httpMethod = "PUT")
    @Log(module = BoCloudService.IMS, target = "batchAccount", operation = "更新batchAccount")
    @PutMapping(value = "/{id}")
    public BocloudResult modify(@PathVariable(value = Common.ID) Long id,
                                @RequestBody BatchAccount entityParams,
                                @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.modify(entityParams, context);
    }

    /**
     * 删除
     *
     * @param id
     * @param context
     * @return
     */
    @ApiOperation(tags = {"CMC", "CSC"}, value = "batchAccount删除", httpMethod = "DELETE")
    @Log(module = BoCloudService.IMS, target = "batchAccount", operation = "删除batchAccount")
    @DeleteMapping("/{id}")
    public BocloudResult remove(@PathVariable(value = Common.ID) Long id,
                                @Value(Common.REQ_CONTEXT) RequestContext context) {
        return service.remove(id, context);
    }

}