package com.crm.manager.controller;

import com.crm.login.rely.backend.controller.BaseLoginController;
import com.crm.manager.service.CustomLoginFeignService;
import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.model.dto.custom.login.CustomLoginAssetManagementDto;
import com.crm.rely.backend.model.dto.custom.login.CustomLoginDemoDto;
import com.crm.rely.backend.model.dto.custom.login.CustomLoginDto;
import com.crm.rely.backend.model.dto.custom.login.CustomLoginFirmOfferDto;
import com.crm.rely.backend.model.entity.custom.login.CustomLoginApproveEntity;
import com.crm.rely.backend.model.entity.custom.login.CustomLoginSearchListEntity;
import com.crm.rely.backend.model.entity.custom.login.asset.management.CustomLoginAssetManagementApproveEntity;
import com.crm.rely.backend.model.entity.custom.login.asset.management.CustomLoginAssetManagementSearchListEntity;
import com.crm.rely.backend.model.entity.custom.login.demo.CustomLoginDemoApproveEntity;
import com.crm.rely.backend.model.entity.custom.login.demo.CustomLoginDemoSearchListEntity;
import com.crm.rely.backend.model.entity.custom.login.firm.offer.CustomLoginFirmOfferApproveEntity;
import com.crm.rely.backend.model.entity.custom.login.firm.offer.CustomLoginFirmOfferSearchListEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
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;

@RestController
@RequestMapping("/custom/login")
public class CustomLoginController extends BaseLoginController {
    @Autowired
    private CustomLoginFeignService customLoginFeignService;

    @PostMapping("/demo/approve")
    public BaseResultDto approveDemo(@RequestBody @Validated CustomLoginDemoApproveEntity entity) throws Exception {


        return customLoginFeignService.approveDemo(entity);
    }

    @PostMapping("/demo/search/list")
    public ResultWithPagerDto<CustomLoginDemoDto> searchDemoPageList(@RequestBody @Validated CustomLoginDemoSearchListEntity entity) throws Exception {

        ResultWithPagerDto<CustomLoginDemoDto> result = customLoginFeignService.searchDemoPageList(entity);

        return result;
    }

    @PostMapping("/firm/offer/approve")
    public BaseResultDto approveFirmOffer(@RequestBody @Validated CustomLoginFirmOfferApproveEntity entity) throws Exception {


        return customLoginFeignService.approveFirmOffer(entity);
    }

    @PostMapping("/firm/offer/search/list")
    public ResultWithPagerDto<CustomLoginFirmOfferDto> searchFirmOfferPageList(@RequestBody @Validated CustomLoginFirmOfferSearchListEntity entity) throws Exception {

        ResultWithPagerDto<CustomLoginFirmOfferDto> result = customLoginFeignService.searchFirmOfferPageList(entity);

        return result;
    }


    @PostMapping("/asset/management/approve")
    public BaseResultDto approveAssetManagement(@RequestBody @Validated CustomLoginAssetManagementApproveEntity entity) throws Exception {


        return customLoginFeignService.approveAssetManagement(entity);
    }

    @PostMapping("/asset/management/search/list")
    public ResultWithPagerDto<CustomLoginAssetManagementDto> searchAssetManagementPageList(@RequestBody @Validated CustomLoginAssetManagementSearchListEntity entity) throws Exception {

        ResultWithPagerDto<CustomLoginAssetManagementDto> result = customLoginFeignService.searchAssetManagementPageList(entity);

        return result;
    }

    @PostMapping("/approve")
    public BaseResultDto approve(@RequestBody @Validated CustomLoginApproveEntity entity) throws Exception {


        return customLoginFeignService.approve(entity);
    }

    @PostMapping("/search/list")
    public ResultWithPagerDto<CustomLoginDto> searchPageList(@RequestBody @Validated CustomLoginSearchListEntity entity) throws Exception {

        ResultWithPagerDto<CustomLoginDto> result = customLoginFeignService.searchPageList(entity);

        return result;
    }
}
