import { Injectable } from '@angular/core';
import { HTTP } from '@ionic-native/http/ngx';

export const IMAGE_BASE_URL: string = 'https://www.punjabkingsipl.in/static-assets/waf-images/';

@Injectable({
    providedIn: 'root'
})
export class NewsService {
    constructor(
        private http: HTTP
    ) { }

    getArticles() {
        return this.http.get('https://www.punjabkingsipl.in/api/listing?entities=4&otherent=1,8021&pgnum=1&inum=10&pgsize=10', {}, {});
    }

    getArticleDetails(title_alias_from_listing_api: string) {
        return this.http.get('https://www.punjabkingsipl.in/api/article/' + title_alias_from_listing_api + '?is_app=1', {}, {});
    }

    getVideos() {
        return this.http.get('https://www.punjabkingsipl.in/api/listing?entities=3,4&otherent=&pgnum=1&inum=10&pgsize=10', {}, {});
    }

    getVideoDetails(title_alias_from_listing_api: string) {
        return this.http.get('https://www.punjabkingsipl.in/api/video/' + title_alias_from_listing_api, {}, {});
    }

    getGalleries() {
        return this.http.get('https://www.punjabkingsipl.in/api/listing?entities=2,4&otherent=&pgnum=1&inum=10&pgsize=10', {}, {});
    }

    getGalleryDetails(title_alias_from_listing_api: string) {
        return this.http.get('https://www.punjabkingsipl.in/api/photo/' + title_alias_from_listing_api, {}, {});
    }
}
