import 'package:syncrow_web/utils/constants/action_enum.dart';

class TagModelUpdate {
  final Action action;
  final String? uuid;
  final String? tag;
  final String? productUuid;
  final String? newTagUuid;

  TagModelUpdate({
    required this.action,
    this.uuid,
    this.tag,
    this.productUuid,
    this.newTagUuid,
  });

  factory TagModelUpdate.fromJson(Map<String, dynamic> json) {
    return TagModelUpdate(
      action: json['action'],
      uuid: json['uuid'],
      tag: json['tag'],
      productUuid: json['productUuid'],
    );
  }

  // Method to convert an instance to JSON
  Map<String, dynamic> toJson() {
    return {
      'action': action.value,
      'tagUuid': uuid,
      'name': tag,
      'productUuid': productUuid,
      'newTagUuid': newTagUuid
    };
  }
}
