import { Injectable } from '@angular/core';
import { Camera } from 'ionic-native';

@Injectable()
export class CameraProvider {
    
    options: any;

    constructor() { 
        this.options = {
            sourceType: Camera.PictureSourceType.CAMERA,
            destinationType: Camera.DestinationType.DATA_URL,
            correctOrientation: true,
            saveToPhotoAlbum: false,
            targetHeight: 300,
            targetWidth: 300
        }
    }    
    
    /**
     *
     */
    getPicture(source: string): Promise<any> {
        if (source == "album") {
            this.options.sourceType = Camera.PictureSourceType.SAVEDPHOTOALBUM;
        }
        
        return Camera.getPicture(this.options);
    }
}