23 lines
502 B
TypeScript
23 lines
502 B
TypeScript
export class RestrictionCheckResult {
|
|
private constructor(
|
|
public readonly allowed: boolean,
|
|
public readonly message: string | null,
|
|
) {}
|
|
|
|
static allowed(): RestrictionCheckResult {
|
|
return new RestrictionCheckResult(true, null)
|
|
}
|
|
|
|
static blocked(message: string): RestrictionCheckResult {
|
|
return new RestrictionCheckResult(false, message)
|
|
}
|
|
|
|
isAllowed(): boolean {
|
|
return this.allowed
|
|
}
|
|
|
|
isBlocked(): boolean {
|
|
return !this.allowed
|
|
}
|
|
}
|