/*
 * Copyright 2021 Tianmian Tech. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.welab.wefe.data.fusion.service.api.task;

import com.welab.wefe.common.exception.StatusCodeWithException;
import com.welab.wefe.common.fieldvalidate.annotation.Check;
import com.welab.wefe.common.web.api.base.AbstractNoneOutputApi;
import com.welab.wefe.common.web.api.base.Api;
import com.welab.wefe.common.web.dto.AbstractApiInput;
import com.welab.wefe.common.web.dto.ApiResult;
import com.welab.wefe.data.fusion.service.enums.AlgorithmType;
import com.welab.wefe.data.fusion.service.enums.DataResourceType;
import com.welab.wefe.data.fusion.service.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author hunter.zhao
 */
@Api(path = "task/update", name = "修改对齐任务", desc = "修改对齐任务", login = true)
public class UpdateApi extends AbstractNoneOutputApi<UpdateApi.Input> {

    @Autowired
    TaskService taskService;

    @Override
    protected ApiResult handler(Input input) throws StatusCodeWithException {
        taskService.update(input);
        return success();
    }

    public static class Input extends AbstractApiInput {
        @Check(name = "任务Id", require = true)
        private String id;

        @Check(name = "任务名称", require = true)
        private String name;

        @Check(name = "合作方id", require = true)
        private String partnerMemberId;

        @Check(name = "数据资源id", require = true)
        private String dataResourceId;

        @Check(name = "布隆过滤器id", require = true)
        private DataResourceType dataResourceType;

        @Check(name = "算法")
        private AlgorithmType algorithm = AlgorithmType.RSA_PSI;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getPartnerMemberId() {
            return partnerMemberId;
        }

        public void setPartnerMemberId(String partnerMemberId) {
            this.partnerMemberId = partnerMemberId;
        }

        public String getDataResourceId() {
            return dataResourceId;
        }

        public void setDataResourceId(String dataResourceId) {
            this.dataResourceId = dataResourceId;
        }

        public DataResourceType getDataResourceType() {
            return dataResourceType;
        }

        public void setDataResourceType(DataResourceType dataResourceType) {
            this.dataResourceType = dataResourceType;
        }

        public AlgorithmType getAlgorithm() {
            return algorithm;
        }

        public void setAlgorithm(AlgorithmType algorithm) {
            this.algorithm = algorithm;
        }
    }
}
