| | | 1 | | namespace RoleRadar.Domain.Tracking; |
| | | 2 | | |
| | | 3 | | public enum OwnershipType |
| | | 4 | | { |
| | | 5 | | Public, |
| | | 6 | | Private, |
| | | 7 | | PeBacked, |
| | | 8 | | VcBacked, |
| | | 9 | | Mutual, |
| | | 10 | | Subsidiary, |
| | | 11 | | Nonprofit, |
| | | 12 | | Government, |
| | | 13 | | Unknown |
| | | 14 | | } |
| | | 15 | | |
| | | 16 | | public enum CompanyStatus |
| | | 17 | | { |
| | | 18 | | Target, |
| | | 19 | | Watch, |
| | | 20 | | Avoid, |
| | | 21 | | Neutral |
| | | 22 | | } |
| | | 23 | | |
| | | 24 | | public enum CultureLevel |
| | | 25 | | { |
| | | 26 | | Stable, |
| | | 27 | | Moderate, |
| | | 28 | | HighRisk, |
| | | 29 | | Unknown |
| | | 30 | | } |
| | | 31 | | |
| | | 32 | | public enum PostingDisposition |
| | | 33 | | { |
| | | 34 | | Lead, |
| | | 35 | | Scored, |
| | | 36 | | Applied, |
| | | 37 | | Rejected, |
| | | 38 | | ScreenedOut, |
| | | 39 | | Closed, |
| | | 40 | | Unscored |
| | | 41 | | } |
| | | 42 | | |
| | | 43 | | public enum ResurfacePolicy |
| | | 44 | | { |
| | | 45 | | Never, |
| | | 46 | | IfReopened |
| | | 47 | | } |
| | | 48 | | |
| | | 49 | | public enum SourceKind |
| | | 50 | | { |
| | | 51 | | Ats, |
| | | 52 | | Aggregator |
| | | 53 | | } |
| | | 54 | | |
| | | 55 | | public enum RemoteType |
| | | 56 | | { |
| | | 57 | | Remote, |
| | | 58 | | Hybrid, |
| | | 59 | | Onsite, |
| | | 60 | | Unknown |
| | | 61 | | } |
| | | 62 | | |
| | | 63 | | public enum FetchMethod |
| | | 64 | | { |
| | | 65 | | Api, |
| | | 66 | | Browser, |
| | | 67 | | Blocked |
| | | 68 | | } |
| | | 69 | | |
| | | 70 | | public enum CriterionCategory |
| | | 71 | | { |
| | | 72 | | HardSkip, |
| | | 73 | | Weight, |
| | | 74 | | Preference |
| | | 75 | | } |
| | | 76 | | |
| | | 77 | | public enum ProvenanceKind |
| | | 78 | | { |
| | | 79 | | Stated, |
| | | 80 | | Inferred |
| | | 81 | | } |
| | | 82 | | |
| | | 83 | | public enum ResumeVariant |
| | | 84 | | { |
| | | 85 | | Tailored, |
| | | 86 | | AsIs, |
| | | 87 | | IcFramed |
| | | 88 | | } |
| | | 89 | | |
| | | 90 | | public enum ApplicationOutcome |
| | | 91 | | { |
| | | 92 | | Applied, |
| | | 93 | | Rejected, |
| | | 94 | | Closed |
| | | 95 | | } |
| | | 96 | | |
| | | 97 | | public enum ApplicationEventType |
| | | 98 | | { |
| | | 99 | | Applied, |
| | | 100 | | FollowUp, |
| | | 101 | | Interview, |
| | | 102 | | Offer, |
| | | 103 | | OfferAccepted, |
| | | 104 | | OfferDeclined, |
| | | 105 | | Rejected, |
| | | 106 | | Withdrawn, |
| | | 107 | | |
| | | 108 | | /// <summary>A remark or correction. Never a response, a rejection or an interview, and never a status change.</summ |
| | | 109 | | Note |
| | | 110 | | } |
| | | 111 | | |
| | | 112 | | public enum SignalType |
| | | 113 | | { |
| | | 114 | | Repost, |
| | | 115 | | NoSalary, |
| | | 116 | | ParallelPosting, |
| | | 117 | | Gone, |
| | | 118 | | Phantom, |
| | | 119 | | Deadline |
| | | 120 | | } |
| | | 121 | | |
| | | 122 | | public enum ContactRelationship |
| | | 123 | | { |
| | | 124 | | Recruiter, |
| | | 125 | | Referral, |
| | | 126 | | HiringManager, |
| | | 127 | | Peer, |
| | | 128 | | Redacted |
| | | 129 | | } |
| | | 130 | | |
| | | 131 | | public static class TrackingEnumExtensions |
| | | 132 | | { |
| | 13646 | 133 | | public static string ToSnakeCase(this PostingDisposition disposition) => disposition switch |
| | 13646 | 134 | | { |
| | 10874 | 135 | | PostingDisposition.Lead => "lead", |
| | 158 | 136 | | PostingDisposition.Unscored => "unscored", |
| | 398 | 137 | | PostingDisposition.Scored => "scored", |
| | 1072 | 138 | | PostingDisposition.Applied => "applied", |
| | 418 | 139 | | PostingDisposition.ScreenedOut => "screened_out", |
| | 234 | 140 | | PostingDisposition.Closed => "closed", |
| | 492 | 141 | | PostingDisposition.Rejected => "rejected", |
| | 0 | 142 | | _ => disposition.ToString().ToLowerInvariant() |
| | 13646 | 143 | | }; |
| | | 144 | | |
| | | 145 | | public static bool TryParseDisposition(string? val, out PostingDisposition disposition) |
| | | 146 | | { |
| | 6566 | 147 | | disposition = PostingDisposition.Lead; |
| | 6566 | 148 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 149 | | { |
| | 0 | 150 | | return false; |
| | | 151 | | } |
| | | 152 | | |
| | 6566 | 153 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 154 | | switch (s) |
| | | 155 | | { |
| | 10360 | 156 | | case "lead": disposition = PostingDisposition.Lead; return true; |
| | 112 | 157 | | case "unscored": disposition = PostingDisposition.Unscored; return true; |
| | 328 | 158 | | case "scored": disposition = PostingDisposition.Scored; return true; |
| | 956 | 159 | | case "applied": disposition = PostingDisposition.Applied; return true; |
| | | 160 | | case "screened_out": |
| | 516 | 161 | | case "screenedout": disposition = PostingDisposition.ScreenedOut; return true; |
| | 212 | 162 | | case "closed": disposition = PostingDisposition.Closed; return true; |
| | 636 | 163 | | case "rejected": disposition = PostingDisposition.Rejected; return true; |
| | 6 | 164 | | default: return false; |
| | | 165 | | } |
| | | 166 | | } |
| | | 167 | | |
| | 12928 | 168 | | public static string ToSnakeCase(this ResurfacePolicy policy) => policy switch |
| | 12928 | 169 | | { |
| | 12868 | 170 | | ResurfacePolicy.Never => "never", |
| | 60 | 171 | | ResurfacePolicy.IfReopened => "if_reopened", |
| | 0 | 172 | | _ => policy.ToString().ToLowerInvariant() |
| | 12928 | 173 | | }; |
| | | 174 | | |
| | | 175 | | public static bool TryParseResurfacePolicy(string? val, out ResurfacePolicy policy) |
| | | 176 | | { |
| | 8798 | 177 | | policy = ResurfacePolicy.Never; |
| | 8798 | 178 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 179 | | { |
| | 3260 | 180 | | return false; |
| | | 181 | | } |
| | | 182 | | |
| | 5538 | 183 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 184 | | switch (s) |
| | | 185 | | { |
| | 10992 | 186 | | case "never": policy = ResurfacePolicy.Never; return true; |
| | | 187 | | case "if_reopened": |
| | 80 | 188 | | case "ifreopened": policy = ResurfacePolicy.IfReopened; return true; |
| | 2 | 189 | | default: return false; |
| | | 190 | | } |
| | | 191 | | } |
| | | 192 | | |
| | 2586 | 193 | | public static string ToSnakeCase(this SourceKind kind) => kind switch |
| | 2586 | 194 | | { |
| | 2468 | 195 | | SourceKind.Ats => "ats", |
| | 118 | 196 | | SourceKind.Aggregator => "aggregator", |
| | 0 | 197 | | _ => kind.ToString().ToLowerInvariant() |
| | 2586 | 198 | | }; |
| | | 199 | | |
| | | 200 | | public static bool TryParseSourceKind(string? val, out SourceKind kind) |
| | | 201 | | { |
| | 8902 | 202 | | kind = SourceKind.Ats; |
| | 8902 | 203 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 204 | | { |
| | 3216 | 205 | | return false; |
| | | 206 | | } |
| | | 207 | | |
| | 5686 | 208 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 209 | | switch (s) |
| | | 210 | | { |
| | 10840 | 211 | | case "ats": kind = SourceKind.Ats; return true; |
| | 528 | 212 | | case "aggregator": kind = SourceKind.Aggregator; return true; |
| | 2 | 213 | | default: return false; |
| | | 214 | | } |
| | | 215 | | } |
| | | 216 | | |
| | 12656 | 217 | | public static string ToSnakeCase(this RemoteType remoteType) => remoteType switch |
| | 12656 | 218 | | { |
| | 162 | 219 | | RemoteType.Remote => "remote", |
| | 4504 | 220 | | RemoteType.Hybrid => "hybrid", |
| | 88 | 221 | | RemoteType.Onsite => "onsite", |
| | 7902 | 222 | | _ => "unknown" |
| | 12656 | 223 | | }; |
| | | 224 | | |
| | | 225 | | public static bool TryParseRemoteType(string? val, out RemoteType remoteType) |
| | | 226 | | { |
| | 8804 | 227 | | remoteType = RemoteType.Unknown; |
| | 8804 | 228 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 229 | | { |
| | 3264 | 230 | | return false; |
| | | 231 | | } |
| | | 232 | | |
| | 5540 | 233 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 234 | | switch (s) |
| | | 235 | | { |
| | 120 | 236 | | case "remote": remoteType = RemoteType.Remote; return true; |
| | 8616 | 237 | | case "hybrid": remoteType = RemoteType.Hybrid; return true; |
| | 60 | 238 | | case "onsite": remoteType = RemoteType.Onsite; return true; |
| | 2280 | 239 | | case "unknown": remoteType = RemoteType.Unknown; return true; |
| | 2 | 240 | | default: return false; |
| | | 241 | | } |
| | | 242 | | } |
| | | 243 | | |
| | 7900 | 244 | | public static string ToSnakeCase(this CultureLevel cultureLevel) => cultureLevel switch |
| | 7900 | 245 | | { |
| | 24 | 246 | | CultureLevel.Stable => "stable", |
| | 12 | 247 | | CultureLevel.Moderate => "moderate", |
| | 2 | 248 | | CultureLevel.HighRisk => "high_risk", |
| | 7862 | 249 | | _ => "unknown" |
| | 7900 | 250 | | }; |
| | | 251 | | |
| | | 252 | | public static bool TryParseCultureLevel(string? val, out CultureLevel cultureLevel) |
| | | 253 | | { |
| | 8804 | 254 | | cultureLevel = CultureLevel.Unknown; |
| | 8804 | 255 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 256 | | { |
| | 3266 | 257 | | return false; |
| | | 258 | | } |
| | | 259 | | |
| | 5538 | 260 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 261 | | switch (s) |
| | | 262 | | { |
| | 48 | 263 | | case "stable": cultureLevel = CultureLevel.Stable; return true; |
| | 24 | 264 | | case "moderate": cultureLevel = CultureLevel.Moderate; return true; |
| | | 265 | | case "high_risk": |
| | 8 | 266 | | case "highrisk": cultureLevel = CultureLevel.HighRisk; return true; |
| | 10992 | 267 | | case "unknown": cultureLevel = CultureLevel.Unknown; return true; |
| | 2 | 268 | | default: return false; |
| | | 269 | | } |
| | | 270 | | } |
| | | 271 | | |
| | 168 | 272 | | public static string ToSnakeCase(this SignalType signalType) => signalType switch |
| | 168 | 273 | | { |
| | 36 | 274 | | SignalType.Repost => "repost", |
| | 20 | 275 | | SignalType.NoSalary => "no_salary", |
| | 28 | 276 | | SignalType.ParallelPosting => "parallel_posting", |
| | 28 | 277 | | SignalType.Gone => "gone", |
| | 20 | 278 | | SignalType.Phantom => "phantom", |
| | 36 | 279 | | SignalType.Deadline => "deadline", |
| | 0 | 280 | | _ => signalType.ToString().ToLowerInvariant() |
| | 168 | 281 | | }; |
| | | 282 | | |
| | | 283 | | public static bool TryParseSignalType(string? val, out SignalType signalType) |
| | | 284 | | { |
| | 210 | 285 | | signalType = SignalType.Repost; |
| | 210 | 286 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 287 | | { |
| | 0 | 288 | | return false; |
| | | 289 | | } |
| | | 290 | | |
| | 210 | 291 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 292 | | switch (s) |
| | | 293 | | { |
| | 104 | 294 | | case "repost": signalType = SignalType.Repost; return true; |
| | | 295 | | case "no_salary": |
| | 40 | 296 | | case "nosalary": signalType = SignalType.NoSalary; return true; |
| | | 297 | | case "parallel_posting": |
| | 24 | 298 | | case "parallelposting": signalType = SignalType.ParallelPosting; return true; |
| | 104 | 299 | | case "gone": signalType = SignalType.Gone; return true; |
| | 44 | 300 | | case "phantom": signalType = SignalType.Phantom; return true; |
| | 88 | 301 | | case "deadline": signalType = SignalType.Deadline; return true; |
| | 8 | 302 | | default: return false; |
| | | 303 | | } |
| | | 304 | | } |
| | | 305 | | |
| | 1440 | 306 | | public static string ToSnakeCase(this OwnershipType ownershipType) => ownershipType switch |
| | 1440 | 307 | | { |
| | 138 | 308 | | OwnershipType.Public => "public", |
| | 388 | 309 | | OwnershipType.Private => "private", |
| | 76 | 310 | | OwnershipType.PeBacked => "pe_backed", |
| | 76 | 311 | | OwnershipType.VcBacked => "vc_backed", |
| | 32 | 312 | | OwnershipType.Mutual => "mutual", |
| | 50 | 313 | | OwnershipType.Subsidiary => "subsidiary", |
| | 32 | 314 | | OwnershipType.Nonprofit => "nonprofit", |
| | 20 | 315 | | OwnershipType.Government => "government", |
| | 628 | 316 | | _ => "unknown" |
| | 1440 | 317 | | }; |
| | | 318 | | |
| | | 319 | | public static bool TryParseOwnershipType(string? val, out OwnershipType type) |
| | | 320 | | { |
| | 854 | 321 | | type = OwnershipType.Unknown; |
| | 854 | 322 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 323 | | { |
| | 0 | 324 | | return false; |
| | | 325 | | } |
| | | 326 | | |
| | 854 | 327 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 328 | | switch (s) |
| | | 329 | | { |
| | 352 | 330 | | case "public": type = OwnershipType.Public; return true; |
| | 620 | 331 | | case "private": type = OwnershipType.Private; return true; |
| | | 332 | | case "pe_backed": |
| | 64 | 333 | | case "pebacked": type = OwnershipType.PeBacked; return true; |
| | | 334 | | case "vc_backed": |
| | 64 | 335 | | case "vcbacked": type = OwnershipType.VcBacked; return true; |
| | 16 | 336 | | case "mutual": type = OwnershipType.Mutual; return true; |
| | 44 | 337 | | case "subsidiary": type = OwnershipType.Subsidiary; return true; |
| | 16 | 338 | | case "nonprofit": type = OwnershipType.Nonprofit; return true; |
| | 4 | 339 | | case "government": type = OwnershipType.Government; return true; |
| | 524 | 340 | | case "unknown": type = OwnershipType.Unknown; return true; |
| | 2 | 341 | | default: return false; |
| | | 342 | | } |
| | | 343 | | } |
| | | 344 | | |
| | 1332 | 345 | | public static string ToSnakeCase(this CompanyStatus status) => status switch |
| | 1332 | 346 | | { |
| | 416 | 347 | | CompanyStatus.Target => "target", |
| | 122 | 348 | | CompanyStatus.Watch => "watch", |
| | 60 | 349 | | CompanyStatus.Avoid => "avoid", |
| | 734 | 350 | | CompanyStatus.Neutral => "neutral", |
| | 0 | 351 | | _ => status.ToString().ToLowerInvariant() |
| | 1332 | 352 | | }; |
| | | 353 | | |
| | | 354 | | public static bool TryParseCompanyStatus(string? val, out CompanyStatus status) |
| | | 355 | | { |
| | 870 | 356 | | status = CompanyStatus.Neutral; |
| | 870 | 357 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 358 | | { |
| | 0 | 359 | | return false; |
| | | 360 | | } |
| | | 361 | | |
| | 870 | 362 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 363 | | switch (s) |
| | | 364 | | { |
| | 840 | 365 | | case "target": status = CompanyStatus.Target; return true; |
| | 136 | 366 | | case "watch": status = CompanyStatus.Watch; return true; |
| | 64 | 367 | | case "avoid": status = CompanyStatus.Avoid; return true; |
| | 696 | 368 | | case "neutral": status = CompanyStatus.Neutral; return true; |
| | 2 | 369 | | default: return false; |
| | | 370 | | } |
| | | 371 | | } |
| | | 372 | | |
| | 120 | 373 | | public static string ToSnakeCase(this FetchMethod method) => method switch |
| | 120 | 374 | | { |
| | 64 | 375 | | FetchMethod.Api => "api", |
| | 34 | 376 | | FetchMethod.Browser => "browser", |
| | 22 | 377 | | FetchMethod.Blocked => "blocked", |
| | 0 | 378 | | _ => method.ToString().ToLowerInvariant() |
| | 120 | 379 | | }; |
| | | 380 | | |
| | | 381 | | public static bool TryParseFetchMethod(string? val, out FetchMethod method) |
| | | 382 | | { |
| | 118 | 383 | | method = FetchMethod.Api; |
| | 118 | 384 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 385 | | { |
| | 0 | 386 | | return false; |
| | | 387 | | } |
| | | 388 | | |
| | 118 | 389 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 390 | | switch (s) |
| | | 391 | | { |
| | 168 | 392 | | case "api": method = FetchMethod.Api; return true; |
| | 44 | 393 | | case "browser": method = FetchMethod.Browser; return true; |
| | 24 | 394 | | case "blocked": method = FetchMethod.Blocked; return true; |
| | 0 | 395 | | default: return false; |
| | | 396 | | } |
| | | 397 | | } |
| | | 398 | | |
| | 150 | 399 | | public static string ToSnakeCase(this CriterionCategory category) => category switch |
| | 150 | 400 | | { |
| | 60 | 401 | | CriterionCategory.HardSkip => "hard_skip", |
| | 4 | 402 | | CriterionCategory.Weight => "weight", |
| | 86 | 403 | | CriterionCategory.Preference => "preference", |
| | 0 | 404 | | _ => category.ToString().ToLowerInvariant() |
| | 150 | 405 | | }; |
| | | 406 | | |
| | | 407 | | public static bool TryParseCriterionCategory(string? val, out CriterionCategory category) |
| | | 408 | | { |
| | 132 | 409 | | category = CriterionCategory.HardSkip; |
| | 132 | 410 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 411 | | { |
| | 0 | 412 | | return false; |
| | | 413 | | } |
| | | 414 | | |
| | 132 | 415 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 416 | | switch (s) |
| | | 417 | | { |
| | | 418 | | case "hard_skip": |
| | 172 | 419 | | case "hardskip": category = CriterionCategory.HardSkip; return true; |
| | 12 | 420 | | case "weight": category = CriterionCategory.Weight; return true; |
| | 76 | 421 | | case "preference": category = CriterionCategory.Preference; return true; |
| | 2 | 422 | | default: return false; |
| | | 423 | | } |
| | | 424 | | } |
| | | 425 | | |
| | 144 | 426 | | public static string ToSnakeCase(this ProvenanceKind provenance) => provenance switch |
| | 144 | 427 | | { |
| | 120 | 428 | | ProvenanceKind.Stated => "stated", |
| | 24 | 429 | | ProvenanceKind.Inferred => "inferred", |
| | 0 | 430 | | _ => provenance.ToString().ToLowerInvariant() |
| | 144 | 431 | | }; |
| | | 432 | | |
| | | 433 | | public static bool TryParseProvenanceKind(string? val, out ProvenanceKind provenance) |
| | | 434 | | { |
| | 128 | 435 | | provenance = ProvenanceKind.Stated; |
| | 128 | 436 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 437 | | { |
| | 0 | 438 | | return false; |
| | | 439 | | } |
| | | 440 | | |
| | 128 | 441 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 442 | | switch (s) |
| | | 443 | | { |
| | 244 | 444 | | case "stated": provenance = ProvenanceKind.Stated; return true; |
| | 8 | 445 | | case "inferred": provenance = ProvenanceKind.Inferred; return true; |
| | 2 | 446 | | default: return false; |
| | | 447 | | } |
| | | 448 | | } |
| | | 449 | | |
| | 2266 | 450 | | public static string ToSnakeCase(this ResumeVariant variant) => variant switch |
| | 2266 | 451 | | { |
| | 2244 | 452 | | ResumeVariant.Tailored => "tailored", |
| | 12 | 453 | | ResumeVariant.AsIs => "as_is", |
| | 10 | 454 | | ResumeVariant.IcFramed => "ic_framed", |
| | 0 | 455 | | _ => variant.ToString().ToLowerInvariant() |
| | 2266 | 456 | | }; |
| | | 457 | | |
| | | 458 | | public static bool TryParseResumeVariant(string? val, out ResumeVariant variant) |
| | | 459 | | { |
| | 544 | 460 | | variant = ResumeVariant.Tailored; |
| | 544 | 461 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 462 | | { |
| | 0 | 463 | | return false; |
| | | 464 | | } |
| | | 465 | | |
| | 544 | 466 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 467 | | switch (s) |
| | | 468 | | { |
| | 1028 | 469 | | case "tailored": variant = ResumeVariant.Tailored; return true; |
| | | 470 | | case "as_is": |
| | | 471 | | case "asis": |
| | | 472 | | case "not_tailored": |
| | 24 | 473 | | case "nottailored": variant = ResumeVariant.AsIs; return true; |
| | | 474 | | case "ic_framed": |
| | 20 | 475 | | case "icframed": variant = ResumeVariant.IcFramed; return true; |
| | 8 | 476 | | default: return false; |
| | | 477 | | } |
| | | 478 | | } |
| | | 479 | | |
| | 7488 | 480 | | public static string ToSnakeCase(this ApplicationOutcome outcome) => outcome switch |
| | 7488 | 481 | | { |
| | 6006 | 482 | | ApplicationOutcome.Applied => "applied", |
| | 1020 | 483 | | ApplicationOutcome.Rejected => "rejected", |
| | 462 | 484 | | ApplicationOutcome.Closed => "closed", |
| | 0 | 485 | | _ => outcome.ToString().ToLowerInvariant() |
| | 7488 | 486 | | }; |
| | | 487 | | |
| | | 488 | | public static bool TryParseApplicationOutcome(string? val, out ApplicationOutcome outcome) |
| | | 489 | | { |
| | 2912 | 490 | | outcome = ApplicationOutcome.Applied; |
| | 2912 | 491 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 492 | | { |
| | 0 | 493 | | return false; |
| | | 494 | | } |
| | | 495 | | |
| | 2912 | 496 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 497 | | switch (s) |
| | | 498 | | { |
| | 4564 | 499 | | case "applied": outcome = ApplicationOutcome.Applied; return true; |
| | 856 | 500 | | case "rejected": outcome = ApplicationOutcome.Rejected; return true; |
| | 404 | 501 | | case "closed": outcome = ApplicationOutcome.Closed; return true; |
| | 0 | 502 | | default: return false; |
| | | 503 | | } |
| | | 504 | | } |
| | | 505 | | |
| | 2810 | 506 | | public static string ToSnakeCase(this ApplicationEventType eventType) => eventType switch |
| | 2810 | 507 | | { |
| | 1198 | 508 | | ApplicationEventType.Applied => "applied", |
| | 144 | 509 | | ApplicationEventType.FollowUp => "follow_up", |
| | 518 | 510 | | ApplicationEventType.Interview => "interview", |
| | 176 | 511 | | ApplicationEventType.Offer => "offer", |
| | 68 | 512 | | ApplicationEventType.OfferAccepted => "offer_accepted", |
| | 68 | 513 | | ApplicationEventType.OfferDeclined => "offer_declined", |
| | 374 | 514 | | ApplicationEventType.Rejected => "rejected", |
| | 68 | 515 | | ApplicationEventType.Withdrawn => "withdrawn", |
| | 196 | 516 | | ApplicationEventType.Note => "note", |
| | 0 | 517 | | _ => eventType.ToString().ToLowerInvariant() |
| | 2810 | 518 | | }; |
| | | 519 | | |
| | | 520 | | public static bool TryParseApplicationEventType(string? val, out ApplicationEventType eventType) |
| | | 521 | | { |
| | 262 | 522 | | eventType = ApplicationEventType.Applied; |
| | 262 | 523 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 524 | | { |
| | 0 | 525 | | return false; |
| | | 526 | | } |
| | | 527 | | |
| | 262 | 528 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 529 | | switch (s) |
| | | 530 | | { |
| | 176 | 531 | | case "applied": eventType = ApplicationEventType.Applied; return true; |
| | | 532 | | case "follow_up": |
| | 32 | 533 | | case "followup": eventType = ApplicationEventType.FollowUp; return true; |
| | 128 | 534 | | case "interview": eventType = ApplicationEventType.Interview; return true; |
| | 20 | 535 | | case "offer": eventType = ApplicationEventType.Offer; return true; |
| | | 536 | | case "offer_accepted": |
| | 20 | 537 | | case "offeraccepted": eventType = ApplicationEventType.OfferAccepted; return true; |
| | | 538 | | case "offer_declined": |
| | 20 | 539 | | case "offerdeclined": eventType = ApplicationEventType.OfferDeclined; return true; |
| | 68 | 540 | | case "rejected": eventType = ApplicationEventType.Rejected; return true; |
| | 20 | 541 | | case "withdrawn": eventType = ApplicationEventType.Withdrawn; return true; |
| | 36 | 542 | | case "note": eventType = ApplicationEventType.Note; return true; |
| | 2 | 543 | | default: return false; |
| | | 544 | | } |
| | | 545 | | } |
| | | 546 | | |
| | 24 | 547 | | public static string ToSnakeCase(this ContactRelationship relationship) => relationship switch |
| | 24 | 548 | | { |
| | 0 | 549 | | ContactRelationship.Recruiter => "recruiter", |
| | 0 | 550 | | ContactRelationship.Referral => "referral", |
| | 0 | 551 | | ContactRelationship.HiringManager => "hiring_manager", |
| | 20 | 552 | | ContactRelationship.Peer => "peer", |
| | 4 | 553 | | ContactRelationship.Redacted => "redacted", |
| | 0 | 554 | | _ => relationship.ToString().ToLowerInvariant() |
| | 24 | 555 | | }; |
| | | 556 | | |
| | | 557 | | public static bool TryParseContactRelationship(string? val, out ContactRelationship relationship) |
| | | 558 | | { |
| | 0 | 559 | | relationship = ContactRelationship.Recruiter; |
| | 0 | 560 | | if (string.IsNullOrWhiteSpace(val)) |
| | | 561 | | { |
| | 0 | 562 | | return false; |
| | | 563 | | } |
| | | 564 | | |
| | 0 | 565 | | var s = val.Trim().ToLowerInvariant().Replace("-", "_"); |
| | | 566 | | switch (s) |
| | | 567 | | { |
| | 0 | 568 | | case "recruiter": relationship = ContactRelationship.Recruiter; return true; |
| | 0 | 569 | | case "referral": relationship = ContactRelationship.Referral; return true; |
| | | 570 | | case "hiring_manager": |
| | 0 | 571 | | case "hiringmanager": relationship = ContactRelationship.HiringManager; return true; |
| | 0 | 572 | | case "peer": relationship = ContactRelationship.Peer; return true; |
| | 0 | 573 | | case "redacted": relationship = ContactRelationship.Redacted; return true; |
| | 0 | 574 | | default: return false; |
| | | 575 | | } |
| | | 576 | | } |
| | | 577 | | } |