import { Injectable } from '@angular/core';
import { Request } from 'src/app/hmg-common/services/models/request';
import { Observable } from 'rxjs';
import { AuthenticationService } from '../authentication/authentication.service';
import { ConnectorService } from '../connector/connector.service';
import { AnnouncementRequest } from '../models/announcement-request';

@Injectable({
  providedIn: 'root'
})
export class AnnouncementService {
  public static getAnnouncemntList = 'Services/COCWS.svc/REST/GetAnnouncementDiscountsConfigData';

  constructor(
    public authService: AuthenticationService,
    public con: ConnectorService,
    ) { }


    getAnnouncementListService(pageNumber: number, id?: number, onError ?: any , oerrorLable ?: any) {
      const request = new AnnouncementRequest();
      this.authService.authenticateRequest(request);
      request.EmployeeNumber = request.P_USER_NAME;
      request.ItgPageNo = pageNumber;
      request.ItgPageSize = 5;
      request.ItgAwarenessID = 0;
      request.ItgRowID = (id) ? Number(id) : 0;
      return this.con.postNoLoad(
        AnnouncementService.getAnnouncemntList,
        request,
        onError,
        oerrorLable
      );
    }
}
