<template>
  <!-- eslint-disable max-len -->
  <carousel
    :per-page="1"
    :mouse-drag="false"
    :autoplay="true"
    :autoplayTimeout="5000"
    :loop="true"
    :autoplayHoverPause="false"
  >
    <slide
      v-for="(car, i) in carouselList"
      :index="i"
      :key="i"
      :style="{ height:'1000px', width:'100%',  backgroundImage: 'url(' + car.image + ')',  backgroundSize: 'cover', backgroundPosition: 'center center'}"
      calss="myClass"
    >
      <div class="intro-content display-table">
        <div class="table-cell">
          <div class="container">
            <div class="row">
              <div class="col-lg-8">
                <div
                  class="price-a"
                  style="opacity:0.95; border: white solid 3px; border-radius: 15px; background-color: white;"
                >
                  <h1 class="intro-title mb-4">{{ car.header }}</h1>
                  <div v-if="car.isProperty">
                    <p class="color-b" v-html="car.address" />
                  </div>
                  <div v-else>
                    <ul class="list color-b">
                      <li class="d-flex justify-content-between">
                        <strong>Bedrooms:</strong>
                        <span>{{ car.bedrooms }}</span>
                      </li>
                      <li class="d-flex justify-content-between">
                        <strong>Sleeps:</strong>
                        <span>{{ car.sleeps }}</span>
                      </li>
                      <li class="d-flex justify-content-between">
                        <strong>Check in:</strong>
                        <span>{{ car.arrival | toDate }}</span>
                      </li>
                      <li class="d-flex justify-content-between">
                        <strong>Check out:</strong>
                        <span>{{ car.departure | toDate}}</span>
                      </li>
                    </ul>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </slide>
  </carousel>
</template>

<script>
import { mapState, mapActions } from 'vuex';
import { Carousel, Slide } from 'vue-carousel';

export default {
  components: {
    Carousel,
    Slide,
  },
  methods: {
    ...mapActions('carousel', ['getCarouselList']),
  },
  mounted() {
    this.getCarouselList();
  },
  computed: {
    ...mapState('carousel', ['carouselList']),
  },
};
</script>
