<template>
  <el-button-group class="generator-actions">
    <el-button type="primary" native-type="submit" size="large">
      <el-icon class="btn-icon"><RefreshRight /></el-icon>
      {{ t('common.generate') }}
    </el-button>
    <el-button size="large" :disabled="!hasResult" @click.prevent="$emit('copy')">
      <el-icon class="btn-icon"><DocumentCopy /></el-icon>
      {{ t('common.copy') }}
    </el-button>
  </el-button-group>
</template>

<script>
import { RefreshRight, DocumentCopy } from '@element-plus/icons-vue'
import { useI18n } from 'vue-i18n'

export default {
  name: 'GeneratorActions',
  components: {
    RefreshRight,
    DocumentCopy
  },
  props: {
    hasResult: {
      type: Boolean,
      default: false
    }
  },
  emits: ['copy'],
  setup() {
    const { t } = useI18n()
    return { t }
  }
}
</script>

<style scoped lang="scss">
.generator-actions {
  display: inline-flex;
  width: 100%;
  max-width: 480px;
}

.btn-icon {
  margin-right: 0.35rem;
}
</style>
