export class IntegrationError extends Error {
  constructor(
    messageArg: string,
    public readonly code: string,
    public readonly cause?: unknown
  ) {
    super(messageArg);
  }
}

export class DiscoveryError extends IntegrationError {
  constructor(messageArg: string, causeArg?: unknown) {
    super(messageArg, 'DISCOVERY_ERROR', causeArg);
  }
}

export class AuthenticationError extends IntegrationError {
  constructor(messageArg: string, causeArg?: unknown) {
    super(messageArg, 'AUTHENTICATION_ERROR', causeArg);
  }
}

export class DeviceCommunicationError extends IntegrationError {
  constructor(messageArg: string, causeArg?: unknown) {
    super(messageArg, 'DEVICE_COMMUNICATION_ERROR', causeArg);
  }
}
