<template>
	<div v-if="!isReadOnly" class="property-title-time-picker">
		<div class="property-title-time-picker__all-day">
			<NcCheckboxRadioSwitch   :checked="isPrivate"
				@update:checked="toggleIsPrivate">
				{{ $t('calendar', 'Privé') }}
			</NcCheckboxRadioSwitch>
		</div>
	</div>
	<div v-else>
		{{ getIsPrivateLabel }}
	</div>
  </template>
  
  <script>
  import { NcCheckboxRadioSwitch } from '@nextcloud/vue'
  export default {
	name: "PropertyIsPrivate",
	components: {
		NcCheckboxRadioSwitch,
	},
	props: {
		isPrivate: {
			type: Boolean,
			default: false
		},
	},
	computed: {
		getIsPrivateLabel() {
			return this.isPrivate ? this.$t('calendar', 'Privé') : this.$t('calendar', 'Mettre en privé');
		}
	},
	methods: {
		toggleIsPrivate() {
			const newState = !this.isPrivate;
			this.$emit('toggle-is-private',newState)
		},
	}
  };
  </script>
  
  <style scoped>
  .checkbox-container {
	display: flex;
	align-items: center;
	gap: 8px;
  }
  </style>
  