import { Observable } from 'rxjs';
import { createStore } from 'redux';

const filesData1 = {
    resource: 'file:///etc/cdebase/notes/release_notes.md',
    name: 'Release Notes',
    value: 'RELEASENOTES: stackflow1-fad01-node: ----------- NOTES: You can use the following public urls to access your services externally. 8080: https://8080-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8081: https://8081-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8082: https://8082-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8083: https://8083-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8084: https://8084-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8001: https://8001-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8002: https://8002-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8003: https://8003-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8004: https://8004-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8005: https://8005-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3000: https://3000-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3001: https://3001-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3002: https://3002-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3003: https://3003-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3004: https://3004-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3005: https://3005-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com Environment Variables: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/site/wwwroot HOSTNAME=stackflow1-fad01-node-sidecar-bd4f57c5-npx5s ENV=/etc/profiles/.profile CONFIG_PATH=/etc/cdebase/editor/.cdecode.yaml RELEASE_NOTES_PATH=/etc/cdebase/notes/release_notes.md NODE_VERSION=9.4.0 YARN_VERSION=1.3.2 PM2HOME=/pm2home PORT=8080 HOME=/root',
    encoding: 'utf8',
    __typename: 'IContent',
    editorId: 1,
    keepOpen: true,
    preview: true,
    preOpen: false,
    oversize: false,
};

const filesData2 = {
    resource: 'file:///etc/cdebase/notes/release_notes.md',
    name: 'Release Notes',
    value: 'RELEASENOTES: stackflow1-fad01-node: ----------- NOTES: You can use the following public urls to access your services externally. 8080: https://8080-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8081: https://8081-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8082: https://8082-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8083: https://8083-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8084: https://8084-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8001: https://8001-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8002: https://8002-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8003: https://8003-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8004: https://8004-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 8005: https://8005-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3000: https://3000-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3001: https://3001-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3002: https://3002-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3003: https://3003-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3004: https://3004-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com 3005: https://3005-dot-iwpou0m3ruylwmc-dot-stackflow1-fad01.blancboard.com Environment Variables: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/site/wwwroot HOSTNAME=stackflow1-fad01-node-sidecar-bd4f57c5-npx5s ENV=/etc/profiles/.profile CONFIG_PATH=/etc/cdebase/editor/.cdecode.yaml RELEASE_NOTES_PATH=/etc/cdebase/notes/release_notes.md NODE_VERSION=9.4.0 YARN_VERSION=1.3.2 PM2HOME=/pm2home PORT=8080 HOME=/root',
    encoding: 'utf8',
    __typename: 'IContent',
    editorId: 1,
    keepOpen: true,
    preview: true,
    preOpen: false,
    oversize: false,
};

const filesData3 = {
    resource: 'file:///etc/cdebase/notes/release_notes.md',
    name: 'Release Notes',
    value: 'RELEASENOTES: stackflow1-fad01-node: -----------',
    encoding: 'utf8',
    __typename: 'IContent',
    editorId: 1,
    keepOpen: true,
    preview: true,
    preOpen: false,
    oversize: false,
};

function getState$(store) {
    return new Observable(function (observer) {
        // emit the current state as first value:
        observer.next(store.getState());
        const unsubscribe = store.subscribe(function () {
            // emit on every new state changes
            observer.next(store.getState());
        });
        // let's return the function that will be called
        // when the Observable is unsubscribed
        return unsubscribe;
    });
}


const fixedState = { files_stack__edit: { editingFiles: [filesData1, filesData2] }, files_stack__rootpath: '//file/root-path' };
function testReducer(state = fixedState, action) {
    return state;
}
const store = createStore(testReducer);
const state$ = getState$(store);


export const reduxState$ = state$;
