import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';

export interface TextStyleSettings {
  fontColor?: string;
  fontSize?: number;
  fontWeight?: string;
}

@Injectable({ providedIn: 'root' })
export class TextStyleService {
  private settingsSubject = new BehaviorSubject<TextStyleSettings>({
    fontColor: 'rgba(255, 255, 255, 0.92)',
    fontSize: 13,
    fontWeight: 'normal'
  });

  readonly settings$ = this.settingsSubject.asObservable();

  updateSettings(newSettings: Partial<TextStyleSettings>): void {
    const next = { ...this.settingsSubject.value, ...newSettings } as TextStyleSettings;
    this.settingsSubject.next(next);
  }

  getSettings(): TextStyleSettings {
    return { ...this.settingsSubject.value };
  }
}
