import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

export const BASE_URL = 'https://fan-engagement.webtrigon.com';

// https://fan-engagement.webtrigon.com/ - Base URL
// /fixtures/
// /player/<id>
// /match/<id>
// /team/<id>
// /standings/ 

@Injectable({
    providedIn: 'root'
})
export class MatchService {

    constructor(
        private http: HttpClient
    ) { }
    
    getFixtures() {
        return this.http.get(BASE_URL + '/fixtures/').toPromise();
    }
    // 200556
    getMatchDetails(id: number | string) {
        return this.http.get(BASE_URL + '/match/' + id).toPromise();
    }

    getLeagueTable() {
        return this.http.get(BASE_URL + '/standings/').toPromise();
    }

    getPlayerDetails(id: number | string) {
        return this.http.get(BASE_URL + '/player/' + id).toPromise();
    }

    getCommentary(id: number | string) {
        return this.http.get(BASE_URL + '/commentary/' + id).toPromise();
    }

}
