import { z } from 'zod';
export const ReviewScoreSchema = z.object({
    blocking: z.number().int().nonnegative(),
    warnings: z.number().int().nonnegative(),
    suggestions: z.number().int().nonnegative(),
});
export class ReviewScore {
    props;
    constructor(props) {
        this.props = props;
    }
    static create(props) {
        const validated = ReviewScoreSchema.parse(props);
        return new ReviewScore(validated);
    }
    static zero() {
        return new ReviewScore({ blocking: 0, warnings: 0, suggestions: 0 });
    }
    get blocking() {
        return this.props.blocking;
    }
    get warnings() {
        return this.props.warnings;
    }
    get suggestions() {
        return this.props.suggestions;
    }
    get total() {
        return this.blocking + this.warnings + this.suggestions;
    }
    get severity() {
        if (this.blocking > 0)
            return 'critical';
        if (this.warnings > 0)
            return 'warning';
        if (this.suggestions > 0)
            return 'info';
        return 'clean';
    }
    get isClean() {
        return this.total === 0;
    }
    get hasBlockingIssues() {
        return this.blocking > 0;
    }
    add(other) {
        return new ReviewScore({
            blocking: this.blocking + other.blocking,
            warnings: this.warnings + other.warnings,
            suggestions: this.suggestions + other.suggestions,
        });
    }
    toJSON() {
        return { ...this.props };
    }
    toString() {
        return `${this.blocking}B/${this.warnings}W/${this.suggestions}S`;
    }
}
//# sourceMappingURL=reviewScore.valueObject.js.map