import { createCountStepper } from '../utils/create-count-stepper';

var Wick = window.Wick || {};

Wick.PDPCountStepper = {
    el: {
        input: '#quantity-field',
    },

    stepper: null,

    init() {
        Wick.PDPCountStepper.stepper = createCountStepper({
            inputSel: Wick.PDPCountStepper.el.input,
            min: 1,
            max: 99,
            onChange(qty, inputEl) {
                $(inputEl).trigger('change');
            },
        });

        Wick.PDPCountStepper.stepper.init($(document));
    },
};

$(document).ready(function () {
    if (!$(Wick.PDPCountStepper.el.input).length) return;
    Wick.PDPCountStepper.init();
});
