feat(review): implement worker review functionality with rating, feedback, and issue flags
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/// Issue flags that can be attached to a worker review.
|
||||
///
|
||||
/// Maps to the allowed values for the `issue_flags` field in the
|
||||
/// V2 coverage reviews endpoint.
|
||||
enum ReviewIssueFlag {
|
||||
/// Worker arrived late.
|
||||
late('LATE'),
|
||||
|
||||
/// Uniform violation.
|
||||
uniform('UNIFORM'),
|
||||
|
||||
/// Worker misconduct.
|
||||
misconduct('MISCONDUCT'),
|
||||
|
||||
/// Worker did not show up.
|
||||
noShow('NO_SHOW'),
|
||||
|
||||
/// Attitude issue.
|
||||
attitude('ATTITUDE'),
|
||||
|
||||
/// Performance issue.
|
||||
performance('PERFORMANCE'),
|
||||
|
||||
/// Worker left before shift ended.
|
||||
leftEarly('LEFT_EARLY'),
|
||||
|
||||
/// Fallback for unrecognised API values.
|
||||
unknown('UNKNOWN');
|
||||
|
||||
const ReviewIssueFlag(this.value);
|
||||
|
||||
/// The V2 API string representation.
|
||||
final String value;
|
||||
|
||||
/// Deserialises from a V2 API string with safe fallback.
|
||||
static ReviewIssueFlag fromJson(String? value) {
|
||||
if (value == null) return ReviewIssueFlag.unknown;
|
||||
for (final ReviewIssueFlag flag in ReviewIssueFlag.values) {
|
||||
if (flag.value == value) return flag;
|
||||
}
|
||||
return ReviewIssueFlag.unknown;
|
||||
}
|
||||
|
||||
/// Serialises to the V2 API string.
|
||||
String toJson() => value;
|
||||
}
|
||||
Reference in New Issue
Block a user