<template>
	<v-row class="search-box" align="center" no-gutters>
		<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-col :cols="label ? textCols : ''">
			<v-radio-group
				v-model="selected"
				required:rules="radioRules"
				row
				hide-details
				dense
			>
				<v-radio
					label="사용량"
					value="use"
					:ripple="false"
					:color="isDarkMode ? '#1b74d7' : '#4777d9'"
					on-icon="mdi-record-circle"
				></v-radio>
				<v-radio
					label="비용"
					value="cost"
					:ripple="false"
					:color="isDarkMode ? '#1b74d7' : '#4777d9'"
					on-icon="mdi-record-circle"
				></v-radio>
			</v-radio-group>
			<!-- @change="updateBlocCode($event)" -->
		</v-col>
	</v-row>
</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,
		},
	},
	data() {
		return {
			label: '구분',
			labelPrepend: true,
			//   selected:"CYC_DAY"
		};
	},
	computed: {
		...mapState({
			isDarkMode: 'isDarkMode',
			searchParam: state => state.pageData,
		}),
		selected: {
			get() {
				return this.searchParam[this.parentPrgmId].rdbUseCost;
			},
			set(value) {
				return this.setPageData({ rdbUseCost: 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({ rdbUseCost: value });
		},
	},
};
</script>

<style></style>
