import 'package:dio/dio.dart';

/// /api/quarantine — flag a track (with reason + optional notes) and
/// unflag it. Both endpoints are user-scoped: callers can only flag
/// their own quarantine entries; admins use a separate /admin/quarantine
/// surface.
class QuarantineApi {
  QuarantineApi(this._dio);
  final Dio _dio;

  /// POST /api/quarantine. Server returns 201 with the row.
  /// Reason values: bad_rip | wrong_file | wrong_tags | duplicate | other.
  Future<void> flag(String trackId, String reason, {String notes = ''}) async {
    await _dio.post<void>('/api/quarantine', data: {
      'track_id': trackId,
      'reason': reason,
      'notes': notes,
    });
  }

  /// DELETE /api/quarantine/{track_id}. Server returns 204.
  Future<void> unflag(String trackId) async {
    await _dio.delete<void>('/api/quarantine/$trackId');
  }
}
