import { Observable } from 'rxjs/Observable';
import { OdooProvider } from './odoo-provider';
import { DataProvider } from './data-provider';
import 'rxjs/add/observable/concat';

export abstract class BaseSyncProvider<T> {

    constructor(
        public data: DataProvider,
        public odoo: OdooProvider
    ) { }
    
    /**
     *
     */
    doSync(): Observable<T> {
        // return Observable.concat(this.toCreate(), this.toUpdate(), this.toDelete(), this.toSave());
        return Observable.concat(this.toCreate());
    }

    /**
     *
     */
    toCreate(): Observable<T> {
        return new Observable(observer => { 
            
        });
    }

    /**
     *
     */
    toUpdate(): Observable<T> {
        return new Observable(observer => { 

        });
    }

    /**
     *
     */
    toDelete(): Observable<T> {
        return new Observable(observer => {

        });
    }

    /**
     *
     */
    toSave(): Observable<T> {
        return new Observable(observer => { 

        });
    }

    /**
     *
     */
    private getDocumentType(): string {
        return Reflect.getMetadata("document", this);
    }
    
    /**
     *
     */
    private getRestEntrypoint(): string {
        return Reflect.getMetadata("entrypoint", this);
    }
}