<template>
  <buttonQuestion
    class="radioQuestion"
    isOverflowScrollable
    :questionText="questionText"
    :answers="makes"
    groupName="Choose Vehicle Make"
    textPosition="text-start"
    :loaderEnabled="true"
    v-model="modelValue"
  />
</template>

<script>
import buttonQuestion from "@/common-components/button-question/button-question";
// Supporting files
import store from "@/store";
import { storeActions } from "@/constants/store-actions.js";
import baseMixin from "@/mixins/base-mixin.js";

export default {
  name: "make-question",
  data() {
    return {
      questionText: null,
      makes: Array,
    };
  },
  props: {
    modelValue: String,
  },
  components: {
    buttonQuestion,
  },
  methods: {
    loadInitialData() {
      return baseMixin.methods.dispatchNonBlockingStoreAction(
        storeActions.GET_VEHICLE_MAKES,
        { year: store.getters.vehicle.year }
      );
    },
    initializeComponent(cmsContent, initialData) {
      this.questionText = cmsContent.QuestionText;
      this.makes = initialData;
    },
  },
  watch: {
    modelValue(val) {
      this.$emit("update:modelValue", val);
    },
  },
};
</script>
