import useChannelsTabWazzupExtensionStore from './useChannelsTabWazzupExtensionStore.js';

export default Pinia.defineStore('useAdditionallyTabWazzupExtensionStore', {
  state: () => ({
    def_chan_for_reminder: '',
    maximum_number_of_messages_per_hour: '',
    delete_days: '',
  }),

  getters: {
    /**
     * Получить id первого канала.
     * @returns
     */
    getFirstChannelId() {
      const channelStore = useChannelsTabWazzupExtensionStore();
      let channels = channelStore.channels || {};

      if (
        typeof channels === 'object' &&
        Object.keys(channels).length > 0
      ) {
        let channel = channels[Object.keys(channels)[0]];
        return channel?.channel_id || '';
      }
      return '';
    }
  }
});
