@@ -90,18 +90,41 @@ public struct SafetyRating: Equatable, Hashable, Sendable {
90
90
@available ( iOS 15 . 0 , macOS 11 . 0 , macCatalyst 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
91
91
public struct SafetySetting {
92
92
/// Block at and beyond a specified ``SafetyRating/HarmProbability``.
93
- public enum HarmBlockThreshold : String , Sendable {
94
- // Content with `.negligible` will be allowed.
95
- case blockLowAndAbove = " BLOCK_LOW_AND_ABOVE "
93
+ public struct HarmBlockThreshold : EncodableProtoEnum , Sendable {
94
+ enum Kind : String {
95
+ case blockLowAndAbove = " BLOCK_LOW_AND_ABOVE "
96
+ case blockMediumAndAbove = " BLOCK_MEDIUM_AND_ABOVE "
97
+ case blockOnlyHigh = " BLOCK_ONLY_HIGH "
98
+ case blockNone = " BLOCK_NONE "
99
+ case off = " OFF "
100
+ }
101
+
102
+ /// Content with `.negligible` will be allowed.
103
+ public static var blockLowAndAbove : HarmBlockThreshold {
104
+ return self . init ( kind: . blockLowAndAbove)
105
+ }
96
106
97
107
/// Content with `.negligible` and `.low` will be allowed.
98
- case blockMediumAndAbove = " BLOCK_MEDIUM_AND_ABOVE "
108
+ public static var blockMediumAndAbove : HarmBlockThreshold {
109
+ return self . init ( kind: . blockMediumAndAbove)
110
+ }
99
111
100
112
/// Content with `.negligible`, `.low`, and `.medium` will be allowed.
101
- case blockOnlyHigh = " BLOCK_ONLY_HIGH "
113
+ public static var blockOnlyHigh : HarmBlockThreshold {
114
+ return self . init ( kind: . blockOnlyHigh)
115
+ }
102
116
103
117
/// All content will be allowed.
104
- case blockNone = " BLOCK_NONE "
118
+ public static var blockNone : HarmBlockThreshold {
119
+ return self . init ( kind: . blockNone)
120
+ }
121
+
122
+ /// Turn off the safety filter.
123
+ public static var off : HarmBlockThreshold {
124
+ return self . init ( kind: . off)
125
+ }
126
+
127
+ let rawValue : String
105
128
}
106
129
107
130
enum CodingKeys : String , CodingKey {
0 commit comments