<template>
	<!-- <v-col v-if="label" :cols="labelCols">
      <label for="" class="search-box-label">
        <v-icon x-small color="primary" class="mr-1">mdi-record-circle</v-icon>
        {{ label }}
      </label>
    </v-col> -->
	<v-radio-group
		v-model="selected"
		required:rules="radioRules"
		row
		hide-details
		dense
	>
		<v-radio
			v-for="item in radioList"
			:key="item.label"
			:label="item.label"
			:value="item.value"
			:ripple="false"
			:color="isDarkMode ? '#1b74d7' : '#4777d9'"
			on-icon="mdi-record-circle"
		></v-radio>
	</v-radio-group>
	<!-- @change="updateBlocCode($event)" -->
</template>

<script>
import { mapState, mapMutations, mapActions } from 'vuex';
import Utility from '~/plugins/utility';

export default {
	props: {
		parentPrgmId: {
			type: String,
			require: true,
		},
		labelCols: {
			type: Number,
			require: false,
			default: 4,
		},
		textCols: {
			type: Number,
			require: false,
			default: 7,
		},
		radioList: {
			type: Array,
			require: true,
		},
		radioValue: {
			type: String,
			require: false,
			default: 'commRadio',
		},
	},
	data() {
		return {
			labelPrepend: true,
			//   selected:"CYC_DAY"
		};
	},
	computed: {
		...mapState({
			isDarkMode: 'isDarkMode',
			searchParam: state => state.pageData,
		}),
		selected: {
			get() {
				return this.searchParam[this.parentPrgmId][this.radioValue];
			},
			set(value) {
				return this.setPageData({ [this.radioValue]: value });
			},
		},
	},
	watch: {
		selected(value) {
			// 주기에 따른 오늘 기준 기본 날짜 세팅
			this.setDefaultDate(value);
		},
	},
	created() {
		// this.setDefaultDate(this.searchParam[this.parentPrgmId].cmCycle);
	},
	async mounted() {},
	methods: {
		...mapMutations({ setPageData: 'setPageData' }),
		...mapActions({}),
		setDefaultDate(value) {
			this.setPageData({ [this.radioValue]: value });
		},
	},
};
</script>

<style></style>
