| | | 1 | | using LifeChart.Application.DTOs; |
| | | 2 | | using LifeChart.Application.Interfaces; |
| | | 3 | | |
| | | 4 | | namespace LifeChart.Infrastructure.CrisisResources; |
| | | 5 | | |
| | | 6 | | public class StaticCrisisResourceService : ICrisisResourceService |
| | | 7 | | { |
| | 0 | 8 | | private static readonly Dictionary<string, List<CrisisResourceDto>> Resources = new() |
| | 0 | 9 | | { |
| | 0 | 10 | | ["DE"] = |
| | 0 | 11 | | [ |
| | 0 | 12 | | new("Telefonseelsorge", "0800 111 0 111", "https://www.telefonseelsorge.de", true), |
| | 0 | 13 | | new("Telefonseelsorge", "0800 111 0 222", "https://www.telefonseelsorge.de", true) |
| | 0 | 14 | | ], |
| | 0 | 15 | | ["AT"] = |
| | 0 | 16 | | [ |
| | 0 | 17 | | new("Telefonseelsorge Österreich", "142", "https://www.telefonseelsorge.at", true) |
| | 0 | 18 | | ], |
| | 0 | 19 | | ["CH"] = |
| | 0 | 20 | | [ |
| | 0 | 21 | | new("Die Dargebotene Hand", "143", "https://www.143.ch", true) |
| | 0 | 22 | | ], |
| | 0 | 23 | | ["GB"] = |
| | 0 | 24 | | [ |
| | 0 | 25 | | new("Samaritans", "116 123", "https://www.samaritans.org", true) |
| | 0 | 26 | | ], |
| | 0 | 27 | | ["US"] = |
| | 0 | 28 | | [ |
| | 0 | 29 | | new("988 Suicide & Crisis Lifeline", "988", "https://988lifeline.org", true) |
| | 0 | 30 | | ], |
| | 0 | 31 | | ["AU"] = |
| | 0 | 32 | | [ |
| | 0 | 33 | | new("Lifeline Australia", "13 11 14", "https://www.lifeline.org.au", true) |
| | 0 | 34 | | ], |
| | 0 | 35 | | ["CA"] = |
| | 0 | 36 | | [ |
| | 0 | 37 | | new("Crisis Services Canada", "1-833-456-4566", "https://www.crisisservicescanada.ca", true) |
| | 0 | 38 | | ] |
| | 0 | 39 | | }; |
| | | 40 | | |
| | 0 | 41 | | private static readonly List<CrisisResourceDto> FallbackResources = |
| | 0 | 42 | | [ |
| | 0 | 43 | | new("findahelpline.com", "", "https://findahelpline.com", true) |
| | 0 | 44 | | ]; |
| | | 45 | | |
| | | 46 | | public Task<IEnumerable<CrisisResourceDto>> GetForRegionAsync(string regionCode) |
| | | 47 | | { |
| | 0 | 48 | | var result = Resources.TryGetValue(regionCode.ToUpperInvariant(), out var resources) |
| | 0 | 49 | | ? resources |
| | 0 | 50 | | : FallbackResources; |
| | | 51 | | |
| | 0 | 52 | | return Task.FromResult<IEnumerable<CrisisResourceDto>>(result); |
| | | 53 | | } |
| | | 54 | | } |