package com.sdtool.common.tdoc;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017-03-28.
 */
public class TAppMethod {

    private String methodName;
    private String url;
    private Integer methodId;
    private Boolean auth;
    private String result;
    private String supportMethods;

    private int callFlag;

    private int sort;

    private List<String> demoJquery = new ArrayList<>();

    private List<TAppCallParam> callParamList = new ArrayList<>();

    private List<TAppMethodParam> paramList = new ArrayList<>();
    private List<TAppMethodClass> classList = new ArrayList<>();

    public String getMethodName() {
        return methodName;
    }

    public TAppMethod setMethodName(String methodName) {
        this.methodName = methodName;
        return this;
    }

    public String getUrl() {
        return url;
    }

    public TAppMethod setUrl(String url) {
        this.url = url;
        return this;
    }

    public Integer getMethodId() {
        return methodId;
    }

    public TAppMethod setMethodId(Integer methodId) {
        this.methodId = methodId;
        return this;
    }

    public Boolean getAuth() {
        return auth;
    }

    public TAppMethod setAuth(Boolean auth) {
        this.auth = auth;
        return this;
    }

    public String getResult() {
        return result;
    }

    public TAppMethod setResult(String result) {
        this.result = result;
        return this;
    }

    public String getSupportMethods() {
        return supportMethods;
    }

    public TAppMethod setSupportMethods(String supportMethods) {
        this.supportMethods = supportMethods;
        return this;
    }

    public void addCallParam(TAppCallParam param) {
        callParamList.add(param);
    }

    public List<TAppCallParam> getCallParamList() {
        return callParamList;
    }

    public void setCallParamList(List<TAppCallParam> callParamList) {
        this.callParamList = callParamList;
    }

    public void addParam(TAppMethodParam param) {
        paramList.add(param);
    }

    public List<TAppMethodParam> getParamList() {
        return paramList;
    }

    public void setParamList(List<TAppMethodParam> paramList) {
        this.paramList = paramList;
    }

    public List<TAppMethodClass> getClassList() {
        return classList;
    }

    public void setClassList(List<TAppMethodClass> classList) {
        this.classList = classList;
    }

    public void addClass(TAppMethodClass clazz) {
        classList.add(clazz);
    }

    public boolean containClass(String className, boolean result) {
        return classList.stream().filter((x) -> ((className.equalsIgnoreCase(x.getClassName())) && (x.isResult() == result))).findFirst().orElse(null) != null;
    }

    public List<String> getDemoJquery() {
        return demoJquery;
    }

    public void setDemoJquery(List<String> demoJquery) {
        this.demoJquery = demoJquery;
    }

    public int getSort() {
        return sort;
    }

    public TAppMethod setSort(int sort) {
        this.sort = sort;
        return this;
    }

    public int getCallFlag() {
        return callFlag;
    }

    public TAppMethod setCallFlag(int callFlag) {
        this.callFlag = callFlag;
        return this;
    }
}
