package com.yihu.hos.web.framework.model.bo;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.ArrayList;
import java.util.Date;

/**
 * @author Airhead
 * @since 2016/8/4.
 */
@Document
public class ServiceFlow {
    @Id
    private String id;
    private String routeCode;
    private ArrayList<HandleFile> handleFiles;
    private Date updated;
    private String flowType;    //pull or push?

    public String getId() {
        return id;
    }

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

    public String getRouteCode() {
        return routeCode;
    }

    public void setRouteCode(String routeCode) {
        this.routeCode = routeCode;
    }

    public Date getUpdated() {
        return updated;
    }

    public void setUpdated(Date updated) {
        this.updated = updated;
    }

    public ArrayList<HandleFile> getHandleFiles() {
        return handleFiles;
    }

    public void setHandleFiles(ArrayList<HandleFile> handleFiles) {
        this.handleFiles = handleFiles;
    }

    public void addHandleFile(HandleFile handleFile) {
        if (handleFiles == null) {
            handleFiles = new ArrayList<>();
        }

        handleFiles.add(handleFile);
    }

    public String getFlowType() {
        return flowType;
    }

    public void setFlowType(String flowType) {
        this.flowType = flowType;
    }

    static public class HandleFile {
        private String usage;   //router or processor
        private String packageName;
        private String className;
        private String filePath;
        private String fileType;    //java or class
        private String routeCode;

        public HandleFile() {
        }

        public String getPackageName() {
            return packageName;
        }

        public void setPackageName(String packageName) {
            this.packageName = packageName;
        }

        public String getClassName() {
            return className;
        }

        public void setClassName(String className) {
            this.className = className;
        }

        public String getFilePath() {
            return filePath;
        }

        public void setFilePath(String filePath) {
            this.filePath = filePath;
        }

        public String getFileType() {
            return fileType;
        }

        public void setFileType(String fileType) {
            this.fileType = fileType;
        }

        public String getUsage() {
            return usage;
        }

        public void setUsage(String usage) {
            this.usage = usage;
        }

        public String getRouteCode() {
            return routeCode;
        }

        public void setRouteCode(String routeCode) {
            this.routeCode = routeCode;
        }
    }
}
