import 'package:dartz/dartz.dart';
import 'package:equatable/equatable.dart';
import 'package:tugas_akhir_supabase/core/errors/failures.dart';
import 'package:tugas_akhir_supabase/domain/entities/field.dart';
import 'package:tugas_akhir_supabase/domain/repositories/field_repository.dart';

class GetFields {
  final FieldRepository repository;

  GetFields(this.repository);

  Future<Either<Failure, List<Field>>> call(String userId) async {
    return await repository.getFields(userId);
  }
}

class CreateField {
  final FieldRepository repository;

  CreateField(this.repository);

  Future<Either<Failure, Field>> call(Field field) async {
    return await repository.createField(field);
  }
}

class UpdateField {
  final FieldRepository repository;

  UpdateField(this.repository);

  Future<Either<Failure, Field>> call(Field field) async {
    return await repository.updateField(field);
  }
}

class DeleteField {
  final FieldRepository repository;

  DeleteField(this.repository);

  Future<Either<Failure, bool>> call(String fieldId) async {
    return await repository.deleteField(fieldId);
  }
} 