// Fake Jam Client Messages - P2P message factory for recording operations
import { generateUUID } from './helpers/utils.js';

export class FakeJamClientMessages {
  constructor() {
    this.Types = {
      START_RECORDING: 'start_recording',
      START_RECORDING_ACK: 'start_recording_ack',
      STOP_RECORDING: 'stop_recording',
      STOP_RECORDING_ACK: 'stop_recording_ack',
      ABORT_RECORDING: 'abort_recording'
    };
  }

  startRecording(recordingId) {
    const msg = {
      type: this.Types.START_RECORDING,
      msgId: generateUUID(),
      recordingId
    };
    return msg;
  }

  startRecordingAck(recordingId, success, reason, detail) {
    const msg = {
      type: this.Types.START_RECORDING_ACK,
      msgId: generateUUID(),
      recordingId,
      success,
      reason,
      detail
    };
    return msg;
  }

  stopRecording(recordingId, success = true, reason, detail) {
    const msg = {
      type: this.Types.STOP_RECORDING,
      msgId: generateUUID(),
      recordingId,
      success,
      reason,
      detail
    };
    return msg;
  }

  stopRecordingAck(recordingId, success, reason, detail) {
    const msg = {
      type: this.Types.STOP_RECORDING_ACK,
      msgId: generateUUID(),
      recordingId,
      success,
      reason,
      detail
    };
    return msg;
  }

  abortRecording(recordingId, reason, detail) {
    const msg = {
      type: this.Types.ABORT_RECORDING,
      msgId: generateUUID(),
      recordingId,
      success: false,
      reason,
      detail
    };
    return msg;
  }
}
