2025-07-07 03:42:35 +02:00
import { z } from "zod/v4" ;
2025-02-12 23:04:44 +01:00
import { Account } from "./account.ts" ;
import { Id } from "./common.ts" ;
export const Report = z
. object ( {
2025-07-07 03:42:35 +02:00
id : Id.meta ( {
2025-02-12 23:04:44 +01:00
description : "The ID of the report in the database." ,
example : "9b0cd757-324b-4ea6-beab-f6226e138886" ,
} ) ,
2025-07-07 03:42:35 +02:00
action_taken : z.boolean ( ) . meta ( {
2025-02-12 23:04:44 +01:00
description : "Whether an action was taken yet." ,
example : false ,
} ) ,
2025-07-07 03:42:35 +02:00
action_taken_at : z.iso.datetime ( ) . nullable ( ) . meta ( {
2025-02-12 23:04:44 +01:00
description : "When an action was taken against the report." ,
example : null ,
} ) ,
2025-07-07 03:42:35 +02:00
category : z.enum ( [ "spam" , "violation" , "other" ] ) . meta ( {
2025-02-12 23:04:44 +01:00
description :
"The generic reason for the report. 'spam' = Unwanted or repetitive content, 'violation' = A specific rule was violated, 'other' = Some other reason." ,
example : "spam" ,
} ) ,
2025-07-07 03:42:35 +02:00
comment : z.string ( ) . meta ( {
2025-02-12 23:04:44 +01:00
description : "The reason for the report." ,
example : "Spam account" ,
} ) ,
2025-07-07 03:42:35 +02:00
forwarded : z.boolean ( ) . meta ( {
2025-02-12 23:04:44 +01:00
description : "Whether the report was forwarded to a remote domain." ,
example : false ,
} ) ,
2025-07-07 03:42:35 +02:00
created_at : z.iso.datetime ( ) . meta ( {
2025-02-12 23:04:44 +01:00
description : "When the report was created." ,
example : "2024-12-31T23:59:59.999Z" ,
} ) ,
status_ids : z
. array ( Id )
. nullable ( )
2025-07-07 03:42:35 +02:00
. meta ( {
2025-02-12 23:04:44 +01:00
description :
"IDs of statuses that have been attached to this report for additional context." ,
example : [ "1abf027c-af03-46ff-8d17-9ee799a17ca7" ] ,
} ) ,
2025-07-07 03:42:35 +02:00
rule_ids : z.array ( z . string ( ) ) . nullable ( ) . meta ( {
2025-02-12 23:04:44 +01:00
description :
"IDs of the rules that have been cited as a violation by this report." ,
example : null ,
} ) ,
2025-07-07 03:42:35 +02:00
target_account : Account.meta ( {
2025-02-12 23:04:44 +01:00
description : "The account that was reported." ,
} ) ,
} )
2025-07-07 03:42:35 +02:00
. meta ( {
2025-02-12 23:04:44 +01:00
description :
"Reports filed against users and/or statuses, to be taken action on by moderators." ,
externalDocs : {
url : "https://docs.joinmastodon.org/entities/Report" ,
} ,
2025-07-07 03:42:35 +02:00
id : "Report" ,
2025-02-12 23:04:44 +01:00
} ) ;