package dp.kotul.solrapiapplication.v1.controller

import dp.kotul.solrapiapplication.facade.TemplateGroupFacade
import dp.kotul.solrapiapplication.model.templategroup.UpdateTemplateGroupsRequest
import dp.kotul.starter.global.DefaultApiResponses
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@Api(tags = ["Template Groups"], description = "API which provide template groups operations in solr index")
@DefaultApiResponses
@RestController
@RequestMapping(value = ["/v1/template-groups"])
class TemplateGroupController(val templateGroupFacade: TemplateGroupFacade) {

    @ApiOperation(value = "Update Template Groups", notes = "Update template groups specified by update template group request")
    @PutMapping(consumes = ["application/json"], produces = ["application/json"])
    fun updateTemplateGroups(
        @ApiParam("Update Template Group Request", required = true) @RequestBody updateTemplateGroupRequest: UpdateTemplateGroupsRequest
    ) {
        return templateGroupFacade.updateTemplateGroups(updateTemplateGroupRequest)
    }
}
