import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { PARTNER_PROFILE_API_ROUTES } from '../constants';
import { IProfileResponse, IResetPasswordRequest } from '../models';

@Injectable({ providedIn: 'root' })
export class ProfileService {
  constructor(private readonly http: HttpClient) {}

  getInfo(): Observable<IProfileResponse> {
    return this.http.get<IProfileResponse>(PARTNER_PROFILE_API_ROUTES.info());
  }

  updateProfile(payload: FormData): Observable<IProfileResponse> {
    return this.http.patch<IProfileResponse>(PARTNER_PROFILE_API_ROUTES.updateInfo(), payload);
  }

  resetPassword(payload: IResetPasswordRequest): Observable<unknown> {
    return this.http.put(PARTNER_PROFILE_API_ROUTES.resetPassword(), payload);
  }
}
