<template>
    <v-select
        dense
        hide-details
        outlined
        :items="items"
        v-model="myvalue"
        :disabled="app.platform == 'b2b'"
    >
    </v-select>
</template>

<script>
    export default {
        props: {
            app: {required: true},
            column: {required: true},
            rowvalues: {required: true},
            items: {default: () => ([
                {
                    text: 'Public',
                    value: 'public',
                },
                {
                    text: 'Privat',
                    value: 'protected',
                }
            ])},
        },

        data: () => ({
            myvalue: null,
        }),

        watch: {
            rowvalues: {
                deep: true,
                handler: function() {
                    this.myvalue = this.rowvalues['col-' + this.column.id];
                },
            },
            
            myvalue: function(value) {
                let r = {...this.rowvalues};
                r['col-' + this.column.id]  = value;
                this.$emit('update-values', r);
            },
        },

        created() {
            this.myvalue = this.rowvalues['col-' + this.column.id];

            if(! this.myvalue)
            {
                this.myvalue = this.app.platform == 'b2b' ? 'public' : 'protected';
            }
        },

        components: {
            CsTextBox: require('@CsVueComp/controls/texts/CsTextBox').default,
        },
        
        name: 'RegistruRowInputStatus',
    }
</script>