This commit is contained in:
2025-12-17 00:33:13 +01:00
parent 8c67081953
commit f01e01e50c
186 changed files with 9242 additions and 1342 deletions

View File

@@ -0,0 +1,40 @@
import { DefenseStatement } from './DefenseStatement';
import { VideoUrl } from './VideoUrl';
import { SubmittedAt } from './SubmittedAt';
export class ProtestDefense {
private constructor(
private readonly _statement: DefenseStatement,
private readonly _videoUrl: VideoUrl | undefined,
private readonly _submittedAt: SubmittedAt
) {}
static create(statement: string, submittedAt: Date, videoUrl?: string): ProtestDefense {
const stmt = DefenseStatement.create(statement);
const video = videoUrl !== undefined ? VideoUrl.create(videoUrl) : undefined;
const submitted = SubmittedAt.create(submittedAt);
return new ProtestDefense(stmt, video, submitted);
}
get statement(): DefenseStatement {
return this._statement;
}
get videoUrl(): VideoUrl | undefined {
return this._videoUrl;
}
get submittedAt(): SubmittedAt {
return this._submittedAt;
}
equals(other: ProtestDefense): boolean {
const videoEqual = this._videoUrl === undefined && other._videoUrl === undefined ||
(this._videoUrl !== undefined && other._videoUrl !== undefined && this._videoUrl.equals(other._videoUrl));
return (
this._statement.equals(other._statement) &&
videoEqual &&
this._submittedAt.equals(other._submittedAt)
);
}
}