package com.zcloud.primeport.service;

import com.alibaba.cola.dto.MultiResponse;
import com.zcloud.primeport.api.ClosedAreaPersonApplyServiceI;
import com.zcloud.primeport.command.ClosedAreaPersonApplyAddExe;
import com.zcloud.primeport.command.ClosedAreaPersonApplyRemoveExe;
import com.zcloud.primeport.command.ClosedAreaPersonApplyUpdateExe;
import com.zcloud.primeport.command.query.ClosedAreaPersonApplyQueryExe;
import com.zcloud.primeport.domain.enums.CloseCarBelongTypeEnum;
import com.zcloud.primeport.dto.*;
import com.zcloud.primeport.dto.clientobject.ClosedAreaPersonApplyCO;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.primeport.dto.clientobject.ClosedAreaPersonApplyDeptCO;
import com.zcloud.primeport.dto.clientobject.UserCo;
import com.zcloud.primeport.persistence.dataobject.UserDto;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
* web-app
* @Author dearLin
* @Date 2026-03-19 13:59:16
*/
@Service
@AllArgsConstructor
public class ClosedAreaPersonApplyServiceImpl implements ClosedAreaPersonApplyServiceI {
    private final ClosedAreaPersonApplyAddExe closedAreaPersonApplyAddExe;
    private final ClosedAreaPersonApplyUpdateExe closedAreaPersonApplyUpdateExe;
    private final ClosedAreaPersonApplyRemoveExe closedAreaPersonApplyRemoveExe;
    private final ClosedAreaPersonApplyQueryExe closedAreaPersonApplyQueryExe;

    @Override
    public ClosedAreaPersonApplyCO  queryById(Long id){
        return closedAreaPersonApplyQueryExe.queryById(id);
    }
    
    @Override
    public PageResponse<ClosedAreaPersonApplyCO> listPage(ClosedAreaPersonApplyPageQry qry){

        return closedAreaPersonApplyQueryExe.execute(qry);
    }

    @Override
    public MultiResponse <ClosedAreaPersonApplyDeptCO> deptList(){
        return closedAreaPersonApplyQueryExe.obtainDeptList();
    }

    @Override
    public SingleResponse add(ClosedAreaPersonApplyAddCmd cmd) {
        closedAreaPersonApplyAddExe.execute(cmd);
        return SingleResponse.buildSuccess();
    }

    @Override
    public void edit(ClosedAreaPersonApplyUpdateCmd closedAreaPersonApplyUpdateCmd) {
        closedAreaPersonApplyUpdateExe.execute(closedAreaPersonApplyUpdateCmd);
    }

    @Override
    public void remove(Long id) {
        closedAreaPersonApplyRemoveExe.execute(id);
    }

    @Override
    public void removeBatch(Long[] ids) {
        closedAreaPersonApplyRemoveExe.execute(ids);
    }

    @Override
    public PageResponse<UserCo> getCorpUserList(ClosedAreaPersonApplyPageQry qry) {
        return closedAreaPersonApplyQueryExe.getCorpUserList(qry);
    }

    @Override
    public void auditPersonApply(ClosedAreaPersonApplyAuditCmd auditCmd) {
        closedAreaPersonApplyUpdateExe.auditPersonApply(auditCmd);
    }

    @Override
    public void authPerson(ClosedAreaPersonApplyAuthCmd cmd) {
        closedAreaPersonApplyUpdateExe.authPerson(cmd);
    }

    @Override
    public Long saveTmpPersonApply(ClosedTmpApplyAddCmd cmd) {
        ClosedAreaPersonApplyAddCmd personApplyAddCmd = new ClosedAreaPersonApplyAddCmd();
        BeanUtils.copyProperties(cmd, personApplyAddCmd);
        personApplyAddCmd.setPersonBelongType(CloseCarBelongTypeEnum.TEMPORARY_VEHICLES.getCode());
        return closedAreaPersonApplyAddExe.execute(personApplyAddCmd);
    }

    @Override
    public SingleResponse<ClosedAreaPersonApplyCO> getAuthorizationPersonInfo(Long id) {
        return closedAreaPersonApplyQueryExe.getAuthorizationPersonInfo(id);
    }
}

