import { Inject, Injectable } from '@angular/core';

@Injectable({
    providedIn: 'root',
  })
export class AppCookieService {
    /*private cookieStore = new Map<String, String>();
   
    constructor() {
        this.parseCookies(document.cookie);
    }

    public parseCookies(cookies = document.cookie) {
        if (!!cookies === false) { return; }
        const cookiesArr = cookies.split(';');
        for (const cookie of cookiesArr) {
            const cookieArr = cookie.split('=');
            var key = cookieArr[0].toString();
            this.cookieStore.set(key, cookieArr[1]);
        }
    }

    get(key: string) {
        this.parseCookies();
        return !!this.cookieStore.get(key) ? this.cookieStore.get(key) : null;
    }

    getAll() {
        this.parseCookies();
        return this.cookieStore;
    }

    remove(key: string) {
      document.cookie = `${key} = ; expires=Thu, 1 jan 1990 12:00:00 UTC; path=/`;
    }

    set(key: string, value: string) {
        document.cookie = key + '=' + (value || '');
    }*/
}