/**
 * Cloudflare ABUSE-REPORTS API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service abuse-reports
 */
import * as Schema from "effect/Schema";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import {} from "../errors.js";
// =============================================================================
// Errors
// =============================================================================
export class AbuseReportNotFound extends Schema.TaggedErrorClass()("AbuseReportNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(AbuseReportNotFound, [{ code: 0 }]);
export class InvalidAccountId extends Schema.TaggedErrorClass()("InvalidAccountId", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidAccountId, [{ code: 7003 }]);
export class InvalidRequest extends Schema.TaggedErrorClass()("InvalidRequest", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidRequest, [{ code: 7003 }]);
export const GetAbuseReportRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    reportParam: Schema.String.pipe(T.HttpPath("reportParam")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/abuse-reports/{reportParam}",
}));
export const GetAbuseReportResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    cdate: Schema.String,
    domain: Schema.String,
    mitigationSummary: Schema.Struct({
        acceptedUrlCount: Schema.Number,
        activeCount: Schema.Number,
        externalHostNotified: Schema.Boolean,
        inReviewCount: Schema.Number,
        pendingCount: Schema.Number,
    }).pipe(Schema.encodeKeys({
        acceptedUrlCount: "accepted_url_count",
        activeCount: "active_count",
        externalHostNotified: "external_host_notified",
        inReviewCount: "in_review_count",
        pendingCount: "pending_count",
    })),
    status: Schema.Union([
        Schema.Literals(["accepted", "in_review"]),
        Schema.String,
    ]),
    type: Schema.Union([
        Schema.Literals([
            "PHISH",
            "GEN",
            "THREAT",
            "DMCA",
            "EMER",
            "TM",
            "REG_WHO",
            "NCSEI",
            "NETWORK",
        ]),
        Schema.String,
    ]),
    justification: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    originalWork: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    submitter: Schema.optional(Schema.Union([
        Schema.Struct({
            company: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            telephone: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        }),
        Schema.Null,
    ])),
    urls: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    cdate: "cdate",
    domain: "domain",
    mitigationSummary: "mitigation_summary",
    status: "status",
    type: "type",
    justification: "justification",
    originalWork: "original_work",
    submitter: "submitter",
    urls: "urls",
}))
    .pipe(T.ResponsePath("result"));
export const getAbuseReport = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetAbuseReportRequest,
    output: GetAbuseReportResponse,
    errors: [InvalidAccountId, AbuseReportNotFound],
}));
export const ListAbuseReportsRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    page: Schema.optional(Schema.Number).pipe(T.HttpQuery("page")),
    perPage: Schema.optional(Schema.Number).pipe(T.HttpQuery("per_page")),
    createdAfter: Schema.optional(Schema.String).pipe(T.HttpQuery("created_after")),
    createdBefore: Schema.optional(Schema.String).pipe(T.HttpQuery("created_before")),
    domain: Schema.optional(Schema.String).pipe(T.HttpQuery("domain")),
    mitigationStatus: Schema.optional(Schema.Union([
        Schema.Literals([
            "pending",
            "active",
            "in_review",
            "cancelled",
            "removed",
        ]),
        Schema.String,
    ])).pipe(T.HttpQuery("mitigation_status")),
    sort: Schema.optional(Schema.String).pipe(T.HttpQuery("sort")),
    status: Schema.optional(Schema.Union([Schema.Literals(["accepted", "in_review"]), Schema.String])).pipe(T.HttpQuery("status")),
    type: Schema.optional(Schema.Union([
        Schema.Literals([
            "PHISH",
            "GEN",
            "THREAT",
            "DMCA",
            "EMER",
            "TM",
            "REG_WHO",
            "NCSEI",
            "NETWORK",
        ]),
        Schema.String,
    ])).pipe(T.HttpQuery("type")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/abuse-reports" }));
export const ListAbuseReportsResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Struct({
        items: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                reports: Schema.Array(Schema.Struct({
                    id: Schema.String,
                    cdate: Schema.String,
                    domain: Schema.String,
                    mitigationSummary: Schema.Struct({
                        acceptedUrlCount: Schema.Number,
                        activeCount: Schema.Number,
                        externalHostNotified: Schema.Boolean,
                        inReviewCount: Schema.Number,
                        pendingCount: Schema.Number,
                    }).pipe(Schema.encodeKeys({
                        acceptedUrlCount: "accepted_url_count",
                        activeCount: "active_count",
                        externalHostNotified: "external_host_notified",
                        inReviewCount: "in_review_count",
                        pendingCount: "pending_count",
                    })),
                    status: Schema.Union([
                        Schema.Literals(["accepted", "in_review"]),
                        Schema.String,
                    ]),
                    type: Schema.Union([
                        Schema.Literals([
                            "PHISH",
                            "GEN",
                            "THREAT",
                            "DMCA",
                            "EMER",
                            "TM",
                            "REG_WHO",
                            "NCSEI",
                            "NETWORK",
                        ]),
                        Schema.String,
                    ]),
                    justification: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    originalWork: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    submitter: Schema.optional(Schema.Union([
                        Schema.Struct({
                            company: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                            email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                            name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                            telephone: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    urls: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                }).pipe(Schema.encodeKeys({
                    id: "id",
                    cdate: "cdate",
                    domain: "domain",
                    mitigationSummary: "mitigation_summary",
                    status: "status",
                    type: "type",
                    justification: "justification",
                    originalWork: "original_work",
                    submitter: "submitter",
                    urls: "urls",
                }))),
            })),
            Schema.Null,
        ])),
    }),
    resultInfo: Schema.optional(Schema.Union([
        Schema.Struct({
            count: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            page: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            perPage: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            totalCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            count: "count",
            page: "page",
            perPage: "per_page",
            totalCount: "total_count",
        })),
        Schema.Null,
    ])),
}).pipe(Schema.encodeKeys({ result: "result", resultInfo: "result_info" }));
export const listAbuseReports = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListAbuseReportsRequest,
    output: ListAbuseReportsResponse,
    errors: [InvalidAccountId],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result.items",
        pageSize: "perPage",
    },
}));
export const CreateAbuseReportRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    reportParam: Schema.String.pipe(T.HttpPath("reportParam")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    act: Schema.Union([
        Schema.Literals([
            "abuse_dmca",
            "abuse_trademark",
            "abuse_general",
            "abuse_phishing",
            "abuse_children",
            "abuse_threat",
            "abuse_registrar_whois",
            "abuse_ncsei",
        ]),
        Schema.String,
    ]),
    address1: Schema.optional(Schema.String),
    agentName: Schema.optional(Schema.String),
    agree: Schema.optional(Schema.Literal("1")),
    city: Schema.optional(Schema.String),
    country: Schema.optional(Schema.String),
    email: Schema.String,
    email2: Schema.String,
    hostNotification: Schema.optional(Schema.Union([Schema.Literals(["send", "send-anon"]), Schema.String])),
    name: Schema.String,
    originalWork: Schema.optional(Schema.String),
    ownerNotification: Schema.Union([
        Schema.Literals(["send", "send-anon", "none"]),
        Schema.String,
    ]),
    signature: Schema.optional(Schema.String),
    state: Schema.optional(Schema.String),
    urls: Schema.String,
    comments: Schema.optional(Schema.String),
    company: Schema.optional(Schema.String),
    reportedCountry: Schema.optional(Schema.String),
    reportedUserAgent: Schema.optional(Schema.String),
    tele: Schema.optional(Schema.String),
    title: Schema.optional(Schema.String),
    justification: Schema.optional(Schema.String),
    trademarkNumber: Schema.optional(Schema.String),
    trademarkOffice: Schema.optional(Schema.String),
    trademarkSymbol: Schema.optional(Schema.String),
    destinationIps: Schema.optional(Schema.String),
    portsProtocols: Schema.optional(Schema.String),
    sourceIps: Schema.optional(Schema.String),
    ncmecNotification: Schema.optional(Schema.Union([Schema.Literals(["send", "send-anon"]), Schema.String])),
    regWhoRequest: Schema.optional(Schema.Struct({
        regWhoGoodFaithAffirmation: Schema.Boolean,
        regWhoLawfulProcessingAgreement: Schema.Boolean,
        regWhoLegalBasis: Schema.String,
        regWhoRequestType: Schema.Union([
            Schema.Literals(["disclosure", "invalid_whois"]),
            Schema.String,
        ]),
        regWhoRequestedDataElements: Schema.Array(Schema.Union([
            Schema.Literals([
                "registrant_name",
                "registrant_organization",
                "registrant_email",
                "registrant_phone",
                "registrant_address",
                "registrant_address_country",
                "registrant_address_postal_code",
                "admin_name",
                "admin_organization",
                "admin_email",
                "admin_phone",
                "admin_address",
                "tech_name",
                "tech_organization",
                "tech_email",
                "tech_phone",
                "tech_address",
            ]),
            Schema.String,
        ])),
        regWhoAuthorizationStatement: Schema.optional(Schema.String),
        regWhoRequestorType: Schema.optional(Schema.Union([
            Schema.Literals(["government", "corporation", "individual"]),
            Schema.String,
        ])),
    }).pipe(Schema.encodeKeys({
        regWhoGoodFaithAffirmation: "reg_who_good_faith_affirmation",
        regWhoLawfulProcessingAgreement: "reg_who_lawful_processing_agreement",
        regWhoLegalBasis: "reg_who_legal_basis",
        regWhoRequestType: "reg_who_request_type",
        regWhoRequestedDataElements: "reg_who_requested_data_elements",
        regWhoAuthorizationStatement: "reg_who_authorization_statement",
        regWhoRequestorType: "reg_who_requestor_type",
    }))),
    ncseiSubjectRepresentation: Schema.optional(Schema.Boolean),
}).pipe(Schema.encodeKeys({
    act: "act",
    address1: "address1",
    agentName: "agent_name",
    agree: "agree",
    city: "city",
    country: "country",
    email: "email",
    email2: "email2",
    hostNotification: "host_notification",
    name: "name",
    originalWork: "original_work",
    ownerNotification: "owner_notification",
    signature: "signature",
    state: "state",
    urls: "urls",
    comments: "comments",
    company: "company",
    reportedCountry: "reported_country",
    reportedUserAgent: "reported_user_agent",
    tele: "tele",
    title: "title",
    justification: "justification",
    trademarkNumber: "trademark_number",
    trademarkOffice: "trademark_office",
    trademarkSymbol: "trademark_symbol",
    destinationIps: "destination_ips",
    portsProtocols: "ports_protocols",
    sourceIps: "source_ips",
    ncmecNotification: "ncmec_notification",
    regWhoRequest: "reg_who_request",
    ncseiSubjectRepresentation: "ncsei_subject_representation",
}), T.Http({
    method: "POST",
    path: "/accounts/{account_id}/abuse-reports/{reportParam}",
}));
export const CreateAbuseReportResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.String.pipe(T.ResponsePath("result"));
export const createAbuseReport = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateAbuseReportRequest,
    output: CreateAbuseReportResponse,
    errors: [InvalidRequest],
}));
export const ListMitigationsRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    reportId: Schema.String.pipe(T.HttpPath("reportId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    page: Schema.optional(Schema.Number).pipe(T.HttpQuery("page")),
    perPage: Schema.optional(Schema.Number).pipe(T.HttpQuery("per_page")),
    effectiveAfter: Schema.optional(Schema.String).pipe(T.HttpQuery("effective_after")),
    effectiveBefore: Schema.optional(Schema.String).pipe(T.HttpQuery("effective_before")),
    entityType: Schema.optional(Schema.Union([
        Schema.Literals(["url_pattern", "account", "zone"]),
        Schema.String,
    ])).pipe(T.HttpQuery("entity_type")),
    sort: Schema.optional(Schema.Union([
        Schema.Literals([
            "type,asc",
            "type,desc",
            "effective_date,asc",
            "effective_date,desc",
            "status,asc",
            "status,desc",
            "entity_type,asc",
            "entity_type,desc",
        ]),
        Schema.String,
    ])).pipe(T.HttpQuery("sort")),
    status: Schema.optional(Schema.Union([
        Schema.Literals([
            "pending",
            "active",
            "in_review",
            "cancelled",
            "removed",
        ]),
        Schema.String,
    ])).pipe(T.HttpQuery("status")),
    type: Schema.optional(Schema.Union([
        Schema.Literals([
            "legal_block",
            "misleading_interstitial",
            "phishing_interstitial",
            "network_block",
            "rate_limit_cache",
            "account_suspend",
            "redirect_video_stream",
        ]),
        Schema.String,
    ])).pipe(T.HttpQuery("type")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/abuse-reports/{reportId}/mitigations",
}));
export const ListMitigationsResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Struct({
        items: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                mitigations: Schema.Array(Schema.Struct({
                    id: Schema.String,
                    effectiveDate: Schema.String,
                    entityId: Schema.String,
                    entityType: Schema.Union([
                        Schema.Literals(["url_pattern", "account", "zone"]),
                        Schema.String,
                    ]),
                    status: Schema.Union([
                        Schema.Literals([
                            "pending",
                            "active",
                            "in_review",
                            "cancelled",
                            "removed",
                        ]),
                        Schema.String,
                    ]),
                    type: Schema.Union([
                        Schema.Literals([
                            "legal_block",
                            "misleading_interstitial",
                            "phishing_interstitial",
                            "network_block",
                            "rate_limit_cache",
                            "account_suspend",
                            "redirect_video_stream",
                        ]),
                        Schema.String,
                    ]),
                }).pipe(Schema.encodeKeys({
                    id: "id",
                    effectiveDate: "effective_date",
                    entityId: "entity_id",
                    entityType: "entity_type",
                    status: "status",
                    type: "type",
                }))),
            })),
            Schema.Null,
        ])),
    }),
    resultInfo: Schema.optional(Schema.Union([
        Schema.Struct({
            count: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            page: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            perPage: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            totalCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            count: "count",
            page: "page",
            perPage: "per_page",
            totalCount: "total_count",
        })),
        Schema.Null,
    ])),
}).pipe(Schema.encodeKeys({ result: "result", resultInfo: "result_info" }));
export const listMitigations = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListMitigationsRequest,
    output: ListMitigationsResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result.items",
        pageSize: "perPage",
    },
}));
export const ReviewMitigationRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    reportId: Schema.String.pipe(T.HttpPath("reportId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    appeals: Schema.Array(Schema.Struct({
        id: Schema.String,
        reason: Schema.Union([
            Schema.Literals(["removed", "misclassified"]),
            Schema.String,
        ]),
    })),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/abuse-reports/{reportId}/mitigations/appeal",
}));
export const ReviewMitigationResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        effectiveDate: Schema.String,
        entityId: Schema.String,
        entityType: Schema.Union([
            Schema.Literals(["url_pattern", "account", "zone"]),
            Schema.String,
        ]),
        status: Schema.Union([
            Schema.Literals([
                "pending",
                "active",
                "in_review",
                "cancelled",
                "removed",
            ]),
            Schema.String,
        ]),
        type: Schema.Union([
            Schema.Literals([
                "legal_block",
                "misleading_interstitial",
                "phishing_interstitial",
                "network_block",
                "rate_limit_cache",
                "account_suspend",
                "redirect_video_stream",
            ]),
            Schema.String,
        ]),
    }).pipe(Schema.encodeKeys({
        id: "id",
        effectiveDate: "effective_date",
        entityId: "entity_id",
        entityType: "entity_type",
        status: "status",
        type: "type",
    }))),
});
export const reviewMitigation = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ReviewMitigationRequest,
    output: ReviewMitigationResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
//# sourceMappingURL=abuse-reports.js.map