import inputData from '../data/input';

import verification from '$utils/verification';

import {LibDataComponents} from '$utils/verification/const';


export default <LibMixins>{

    data(){
        return {
            inputData:{},

            components: LibDataComponents
        }
    },

    inject:['setResultData','setStep'],

    methods:{

        submitVerify(){

            let useInputData = [];

            for (let key in this.inputData) {
                if (this.inputData.hasOwnProperty(key)) {
                    useInputData.push(...this.inputData[key]);
                }
            }

            return verification.verificationPromise(useInputData,true).then((resultData)=>{
                this.setResultData(resultData);
                return this.setStep(2);

            });

        }

    },

    created(){
        this.inputData = inputData(this.config);
    }

}