/**
 * 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.Literals(["accepted", "in_review"]),
    type: Schema.Literals([
        "PHISH",
        "GEN",
        "THREAT",
        "DMCA",
        "EMER",
        "TM",
        "REG_WHO",
        "NCSEI",
        "NETWORK",
    ]),
    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.Literals([
        "pending",
        "active",
        "in_review",
        "cancelled",
        "removed",
    ])).pipe(T.HttpQuery("mitigation_status")),
    sort: Schema.optional(Schema.String).pipe(T.HttpQuery("sort")),
    status: Schema.optional(Schema.Literals(["accepted", "in_review"])).pipe(T.HttpQuery("status")),
    type: Schema.optional(Schema.Literals([
        "PHISH",
        "GEN",
        "THREAT",
        "DMCA",
        "EMER",
        "TM",
        "REG_WHO",
        "NCSEI",
        "NETWORK",
    ])).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.Literals(["accepted", "in_review"]),
                    type: Schema.Literals([
                        "PHISH",
                        "GEN",
                        "THREAT",
                        "DMCA",
                        "EMER",
                        "TM",
                        "REG_WHO",
                        "NCSEI",
                        "NETWORK",
                    ]),
                    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.Literal("abuse_dmca"),
    address1: Schema.String,
    agentName: Schema.String,
    agree: Schema.Literal("1"),
    city: Schema.String,
    country: Schema.String,
    email: Schema.String,
    email2: Schema.String,
    hostNotification: Schema.Literal("send"),
    name: Schema.String,
    originalWork: Schema.String,
    ownerNotification: Schema.Literal("send"),
    signature: Schema.String,
    state: 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),
}).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",
}), 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.Literals(["url_pattern", "account", "zone"])).pipe(T.HttpQuery("entity_type")),
    sort: Schema.optional(Schema.Literals([
        "type,asc",
        "type,desc",
        "effective_date,asc",
        "effective_date,desc",
        "status,asc",
        "status,desc",
        "entity_type,asc",
        "entity_type,desc",
    ])).pipe(T.HttpQuery("sort")),
    status: Schema.optional(Schema.Literals([
        "pending",
        "active",
        "in_review",
        "cancelled",
        "removed",
    ])).pipe(T.HttpQuery("status")),
    type: Schema.optional(Schema.Literals([
        "legal_block",
        "phishing_interstitial",
        "network_block",
        "rate_limit_cache",
        "account_suspend",
        "redirect_video_stream",
    ])).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.Literals([
                        "url_pattern",
                        "account",
                        "zone",
                    ]),
                    status: Schema.Literals([
                        "pending",
                        "active",
                        "in_review",
                        "cancelled",
                        "removed",
                    ]),
                    type: Schema.Literals([
                        "legal_block",
                        "phishing_interstitial",
                        "network_block",
                        "rate_limit_cache",
                        "account_suspend",
                        "redirect_video_stream",
                    ]),
                }).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.Literals(["removed", "misclassified"]),
    })),
}).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.Literals(["url_pattern", "account", "zone"]),
        status: Schema.Literals([
            "pending",
            "active",
            "in_review",
            "cancelled",
            "removed",
        ]),
        type: Schema.Literals([
            "legal_block",
            "phishing_interstitial",
            "network_block",
            "rate_limit_cache",
            "account_suspend",
            "redirect_video_stream",
        ]),
    }).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