import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';

import '../../resource/assets.gen.dart';
import '../../resource/string.gen.dart';

enum RecordStatus {
  pending,
  recording,
  paused,
}

extension RecordStatusExtension on RecordStatus {
  String get desc {
    switch (this) {
      case RecordStatus.pending:
        return StringName.recordStatusPending.tr;
      case RecordStatus.recording:
        return StringName.recordStatusRecording.tr;
      case RecordStatus.paused:
        return StringName.recordStatusPaused.tr;
    }
  }

  ImageProvider get actionButtonImage {
    switch (this) {
      case RecordStatus.pending:
        return Assets.images.iconRecordStart.provider();
      case RecordStatus.recording:
        return Assets.images.iconRecordPause.provider();
      case RecordStatus.paused:
        return Assets.images.iconRecordResume.provider();
    }
  }

  ImageProvider get saveButtonImage {
    return this == RecordStatus.pending
        ? Assets.images.iconRecordSaveDisable.provider()
        : Assets.images.iconRecordSaveEnable.provider();
  }

  ImageProvider get cancelButtonImage {
    return this == RecordStatus.pending
        ? Assets.images.iconRecordCancelDisable.provider()
        : Assets.images.iconRecordCancelEnable.provider();
  }

  RecordStatus get nextStatus {
    switch (this) {
      case RecordStatus.pending:
        return RecordStatus.recording;
      case RecordStatus.recording:
        return RecordStatus.paused;
      case RecordStatus.paused:
        return RecordStatus.recording;
    }
  }
}
