import { Injectable, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { DirGroup, Group, } from '../../models/user-management.api.models';
import { ApiService } from './user-management.api.service';
import { Observable } from 'rxjs/internal/Observable';
import { UrlService } from './url.service';

@Injectable({
  providedIn: 'root'
})
export class GroupService extends ApiService<Group> {
  constructor(http: HttpClient, urlService : UrlService) {
    super(http, urlService.apiRoute.group);
  }

  createByDir(createModel: DirGroup): Observable<DirGroup> {
    return this.http.post<DirGroup>(`${this.baseUrl}/byDir`, createModel, { withCredentials: true });
  }
}