import * as path from 'path'
import DocGenerator from 'doxydoc'
# import Component ffrom '../../src/Component'

export const doc = new DocGenerator()
doc.setTitle('DataService')
doc.setFilename(path.join(__dirname, '../', path.basename(__filename).replace('.doc.fire', '.md')))

doc.intro = 'Creates a DataService instance'

doc.section('Sections')
    .description('A DataService holds data of a component.')
    .example('fire', '''
        const dataService = new DataService()

        dataService.set({ test: '1234'})
        log dataService.get()
    ''')

    .description('''
        The method "set()" sets or overwrites data ina DataService. The DataService triggers an event everytime data changes.
        The method "get()" returns all data from a DataService.
    ''')


doc.property('str', 'dataType', 'This can be either "item" or "list" and it defines the data type')
doc.property('obj|arr', 'data', 'Holds the data stored in a "DataService. This is either an "object" or an "array" depending on the dataType')
doc.property('bool', 'isStatic', 'DataService is static. No socket sync messages will be sent to the clients')


doc.method('void', 'init', [], 'Initialize dataService')
doc.method('obj', 'meta', [], 'Returns DataService meta data')


const dataFlow = doc.section('DataStore data flow')
dataFlow.description('This shows how data will be syncronized between client and server')
dataFlow.image(path.join(__dirname, '../assets/datastore_flow.png'), 'DataStore data flow')
