<template>
    <div class="row">
        <div class="col">
            <loading-component style="height: 300px; top: 0;" key="1" color="success" v-show="isLoading" ></loading-component>
            <div class="row justify-content-center" v-show="!isLoading">
                <div class="col">
                    <div class="row m-b-20">
                        <div class="col">
                            <h3 class="all-caps">Are you Sure?</h3>
                            <div class="fs-11">{{ contentText }}</div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col p-r-5">
                            <div class="btn btn-sm btn-default btn-block bg-master-lighter" data-dismiss="modal">Cancel</div>
                        </div>
                        <div class="col p-l-5">
                            <div class="btn btn-sm btn-block b-rad-none" :class="[{'btn-danger': modalType !== 'confirm'}, {'btn-success': modalType === 'confirm'}]" @click="submitForm()">{{ buttonText }}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script>
    import componentHandler from '../../../general/mixins/componentHandler';
    import ModalFormHandler from '../../../general/mixins/modalFormHandler';
    export default {
        props: {
            contentText: {
                type: String,
                required: true
            },
            params: {
                type: Array,
                required: false
            },
            modalType: {
                type: String,
                default: 'confirm'
            },
            buttonText: {
                type: String,
                default: 'Confirm'
            },
            apiRoute: {
                type: String,
                required: true
            },
            apiMethod: {
                type: String,
                required: true
            },
        },
        methods: {
            submitForm() {
                if (this.params) this.parameters = this.params;
                return this.submit(this.apiRoute, this.apiMethod, this.section, true, true);
            }
        },
        mixins: [componentHandler, ModalFormHandler]

    }
</script>
