-
Notifications
You must be signed in to change notification settings - Fork 6
/
job.scala
140 lines (111 loc) · 4.68 KB
/
job.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
* Copyright (c) 2020 etspaceman
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package faker
import org.scalacheck.{Arbitrary, Gen}
import pureconfig.ConfigReader
object job {
type JobEducationLevel = JobEducationLevel.Type
object JobEducationLevel extends Newtype[String] { self =>
def jobEducationLevels(implicit
loader: ResourceLoader
): Seq[JobEducationLevel] =
loader.loadKey[Seq[JobEducationLevel]]("job.education-levels")
implicit def jobEducationLevelArbitrary(implicit
loader: ResourceLoader
): Arbitrary[JobEducationLevel] =
Arbitrary(Gen.oneOf(jobEducationLevels))
implicit val jobEducationLevelConfigReader
: ConfigReader[JobEducationLevel] =
ConfigReader[String].map(self.apply)
}
type JobEmploymentType = JobEmploymentType.Type
object JobEmploymentType extends Newtype[String] { self =>
def jobEmploymentTypes(implicit
loader: ResourceLoader
): Seq[JobEmploymentType] =
loader.loadKey[Seq[JobEmploymentType]]("job.employment-types")
implicit def jobEmploymentTypeArbitrary(implicit
loader: ResourceLoader
): Arbitrary[JobEmploymentType] =
Arbitrary(Gen.oneOf(jobEmploymentTypes))
implicit val jobEmploymentTypeConfigReader
: ConfigReader[JobEmploymentType] =
ConfigReader[String].map(self.apply)
}
type JobField = JobField.Type
object JobField extends Newtype[String] { self =>
def jobFields(implicit loader: ResourceLoader): Seq[JobField] =
loader.loadKey[Seq[JobField]]("job.fields")
implicit def jobFieldArbitrary(implicit
loader: ResourceLoader
): Arbitrary[JobField] =
Arbitrary(Gen.oneOf(jobFields))
implicit val jobFieldConfigReader: ConfigReader[JobField] =
ConfigReader[String].map(self.apply)
}
type JobKeySkill = JobKeySkill.Type
object JobKeySkill extends Newtype[String] { self =>
def jobKeySkills(implicit loader: ResourceLoader): Seq[JobKeySkill] =
loader.loadKey[Seq[JobKeySkill]]("job.key-skills")
implicit def jobKeySkillArbitrary(implicit
loader: ResourceLoader
): Arbitrary[JobKeySkill] =
Arbitrary(Gen.oneOf(jobKeySkills))
implicit val jobKeySkillConfigReader: ConfigReader[JobKeySkill] =
ConfigReader[String].map(self.apply)
}
type JobPosition = JobPosition.Type
object JobPosition extends Newtype[String] { self =>
def jobPositions(implicit loader: ResourceLoader): Seq[JobPosition] =
loader.loadKey[Seq[JobPosition]]("job.positions")
implicit def jobPositionArbitrary(implicit
loader: ResourceLoader
): Arbitrary[JobPosition] =
Arbitrary(Gen.oneOf(jobPositions))
implicit val jobPositionConfigReader: ConfigReader[JobPosition] =
ConfigReader[String].map(self.apply)
}
type JobSeniority = JobSeniority.Type
object JobSeniority extends Newtype[String] { self =>
def jobSeniority(implicit loader: ResourceLoader): Seq[JobSeniority] =
loader.loadKey[Seq[JobSeniority]]("job.seniority")
implicit def jobSeniorityArbitrary(implicit
loader: ResourceLoader
): Arbitrary[JobSeniority] =
Arbitrary(Gen.oneOf(jobSeniority))
implicit val jobSeniorityConfigReader: ConfigReader[JobSeniority] =
ConfigReader[String].map(self.apply)
}
type JobTitle = JobTitle.Type
object JobTitle extends Newtype[String] { self =>
implicit def jobTitleArbitrary(implicit
loader: ResourceLoader
): Arbitrary[JobTitle] =
Arbitrary(
loader
.loadKey[StringGenBuilder]("job.title-builder")
.gen
.map(self.apply)
)
implicit val jobTitleConfigReader: ConfigReader[JobTitle] =
ConfigReader[String].map(self.apply)
}
}