/**
 * Cloudflare RESOURCE-SHARING API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service resource-sharing
 */
import * as Schema from "effect/Schema";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import {} from "../errors.js";
export const GetRecipientRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    recipientId: Schema.String.pipe(T.HttpPath("recipientId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    includeResources: Schema.optional(Schema.Boolean).pipe(T.HttpQuery("include_resources")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/shares/{shareId}/recipients/{recipientId}",
}));
export const GetRecipientResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    accountId: Schema.String,
    associationStatus: Schema.Literals([
        "associating",
        "associated",
        "disassociating",
        "disassociated",
    ]),
    created: Schema.String,
    modified: Schema.String,
    resources: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            error: Schema.String,
            resourceId: Schema.String,
            resourceVersion: Schema.Number,
            terminal: Schema.Boolean,
        }).pipe(Schema.encodeKeys({
            error: "error",
            resourceId: "resource_id",
            resourceVersion: "resource_version",
            terminal: "terminal",
        }))),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    accountId: "account_id",
    associationStatus: "association_status",
    created: "created",
    modified: "modified",
    resources: "resources",
}))
    .pipe(T.ResponsePath("result"));
export const getRecipient = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetRecipientRequest,
    output: GetRecipientResponse,
    errors: [],
}));
export const ListRecipientsRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    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")),
    includeResources: Schema.optional(Schema.Boolean).pipe(T.HttpQuery("include_resources")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/shares/{shareId}/recipients",
}));
export const ListRecipientsResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        accountId: Schema.String,
        associationStatus: Schema.Literals([
            "associating",
            "associated",
            "disassociating",
            "disassociated",
        ]),
        created: Schema.String,
        modified: Schema.String,
        resources: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                error: Schema.String,
                resourceId: Schema.String,
                resourceVersion: Schema.Number,
                terminal: Schema.Boolean,
            }).pipe(Schema.encodeKeys({
                error: "error",
                resourceId: "resource_id",
                resourceVersion: "resource_version",
                terminal: "terminal",
            }))),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        accountId: "account_id",
        associationStatus: "association_status",
        created: "created",
        modified: "modified",
        resources: "resources",
    }))),
    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 listRecipients = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListRecipientsRequest,
    output: ListRecipientsResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateRecipientRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    pathAccountId: Schema.String.pipe(T.HttpPath("path_account_id")),
    bodyAccountId: Schema.optional(Schema.String),
    organizationId: Schema.optional(Schema.String),
}).pipe(Schema.encodeKeys({
    bodyAccountId: "body_account_id",
    organizationId: "organization_id",
}), T.Http({
    method: "POST",
    path: "/accounts/{path_account_id}/shares/{shareId}/recipients",
}));
export const CreateRecipientResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    accountId: Schema.String,
    associationStatus: Schema.Literals([
        "associating",
        "associated",
        "disassociating",
        "disassociated",
    ]),
    created: Schema.String,
    modified: Schema.String,
    resources: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            error: Schema.String,
            resourceId: Schema.String,
            resourceVersion: Schema.Number,
            terminal: Schema.Boolean,
        }).pipe(Schema.encodeKeys({
            error: "error",
            resourceId: "resource_id",
            resourceVersion: "resource_version",
            terminal: "terminal",
        }))),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    accountId: "account_id",
    associationStatus: "association_status",
    created: "created",
    modified: "modified",
    resources: "resources",
}))
    .pipe(T.ResponsePath("result"));
export const createRecipient = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateRecipientRequest,
    output: CreateRecipientResponse,
    errors: [],
}));
export const DeleteRecipientRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    recipientId: Schema.String.pipe(T.HttpPath("recipientId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/shares/{shareId}/recipients/{recipientId}",
}));
export const DeleteRecipientResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    accountId: Schema.String,
    associationStatus: Schema.Literals([
        "associating",
        "associated",
        "disassociating",
        "disassociated",
    ]),
    created: Schema.String,
    modified: Schema.String,
    resources: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            error: Schema.String,
            resourceId: Schema.String,
            resourceVersion: Schema.Number,
            terminal: Schema.Boolean,
        }).pipe(Schema.encodeKeys({
            error: "error",
            resourceId: "resource_id",
            resourceVersion: "resource_version",
            terminal: "terminal",
        }))),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    accountId: "account_id",
    associationStatus: "association_status",
    created: "created",
    modified: "modified",
    resources: "resources",
}))
    .pipe(T.ResponsePath("result"));
export const deleteRecipient = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteRecipientRequest,
    output: DeleteRecipientResponse,
    errors: [],
}));
export const GetResourceRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    resourceId: Schema.String.pipe(T.HttpPath("resourceId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/shares/{shareId}/resources/{resourceId}",
}));
export const GetResourceResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    created: Schema.String,
    meta: Schema.Unknown,
    modified: Schema.String,
    resourceAccountId: Schema.String,
    resourceId: Schema.String,
    resourceType: Schema.Literals([
        "custom-ruleset",
        "widget",
        "gateway-policy",
        "gateway-destination-ip",
        "gateway-block-page-settings",
        "gateway-extended-email-matching",
    ]),
    resourceVersion: Schema.Number,
    status: Schema.Literals(["active", "deleting", "deleted"]),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    created: "created",
    meta: "meta",
    modified: "modified",
    resourceAccountId: "resource_account_id",
    resourceId: "resource_id",
    resourceType: "resource_type",
    resourceVersion: "resource_version",
    status: "status",
}))
    .pipe(T.ResponsePath("result"));
export const getResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetResourceRequest,
    output: GetResourceResponse,
    errors: [],
}));
export const ListResourcesRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    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")),
    resourceType: Schema.optional(Schema.Literals([
        "custom-ruleset",
        "widget",
        "gateway-policy",
        "gateway-destination-ip",
        "gateway-block-page-settings",
        "gateway-extended-email-matching",
    ])).pipe(T.HttpQuery("resource_type")),
    status: Schema.optional(Schema.Literals(["active", "deleting", "deleted"])).pipe(T.HttpQuery("status")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/shares/{shareId}/resources",
}));
export const ListResourcesResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        created: Schema.String,
        meta: Schema.Unknown,
        modified: Schema.String,
        resourceAccountId: Schema.String,
        resourceId: Schema.String,
        resourceType: Schema.Literals([
            "custom-ruleset",
            "widget",
            "gateway-policy",
            "gateway-destination-ip",
            "gateway-block-page-settings",
            "gateway-extended-email-matching",
        ]),
        resourceVersion: Schema.Number,
        status: Schema.Literals(["active", "deleting", "deleted"]),
    }).pipe(Schema.encodeKeys({
        id: "id",
        created: "created",
        meta: "meta",
        modified: "modified",
        resourceAccountId: "resource_account_id",
        resourceId: "resource_id",
        resourceType: "resource_type",
        resourceVersion: "resource_version",
        status: "status",
    }))),
    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 listResources = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListResourcesRequest,
    output: ListResourcesResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateResourceRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    meta: Schema.Unknown,
    resourceAccountId: Schema.String,
    resourceId: Schema.String,
    resourceType: Schema.Literals([
        "custom-ruleset",
        "widget",
        "gateway-policy",
        "gateway-destination-ip",
        "gateway-block-page-settings",
        "gateway-extended-email-matching",
    ]),
}).pipe(Schema.encodeKeys({
    meta: "meta",
    resourceAccountId: "resource_account_id",
    resourceId: "resource_id",
    resourceType: "resource_type",
}), T.Http({
    method: "POST",
    path: "/accounts/{account_id}/shares/{shareId}/resources",
}));
export const CreateResourceResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    created: Schema.String,
    meta: Schema.Unknown,
    modified: Schema.String,
    resourceAccountId: Schema.String,
    resourceId: Schema.String,
    resourceType: Schema.Literals([
        "custom-ruleset",
        "widget",
        "gateway-policy",
        "gateway-destination-ip",
        "gateway-block-page-settings",
        "gateway-extended-email-matching",
    ]),
    resourceVersion: Schema.Number,
    status: Schema.Literals(["active", "deleting", "deleted"]),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    created: "created",
    meta: "meta",
    modified: "modified",
    resourceAccountId: "resource_account_id",
    resourceId: "resource_id",
    resourceType: "resource_type",
    resourceVersion: "resource_version",
    status: "status",
}))
    .pipe(T.ResponsePath("result"));
export const createResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateResourceRequest,
    output: CreateResourceResponse,
    errors: [],
}));
export const UpdateResourceRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    resourceId: Schema.String.pipe(T.HttpPath("resourceId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    meta: Schema.Unknown,
}).pipe(T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/shares/{shareId}/resources/{resourceId}",
}));
export const UpdateResourceResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    created: Schema.String,
    meta: Schema.Unknown,
    modified: Schema.String,
    resourceAccountId: Schema.String,
    resourceId: Schema.String,
    resourceType: Schema.Literals([
        "custom-ruleset",
        "widget",
        "gateway-policy",
        "gateway-destination-ip",
        "gateway-block-page-settings",
        "gateway-extended-email-matching",
    ]),
    resourceVersion: Schema.Number,
    status: Schema.Literals(["active", "deleting", "deleted"]),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    created: "created",
    meta: "meta",
    modified: "modified",
    resourceAccountId: "resource_account_id",
    resourceId: "resource_id",
    resourceType: "resource_type",
    resourceVersion: "resource_version",
    status: "status",
}))
    .pipe(T.ResponsePath("result"));
export const updateResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateResourceRequest,
    output: UpdateResourceResponse,
    errors: [],
}));
export const DeleteResourceRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    resourceId: Schema.String.pipe(T.HttpPath("resourceId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/shares/{shareId}/resources/{resourceId}",
}));
export const DeleteResourceResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    created: Schema.String,
    meta: Schema.Unknown,
    modified: Schema.String,
    resourceAccountId: Schema.String,
    resourceId: Schema.String,
    resourceType: Schema.Literals([
        "custom-ruleset",
        "widget",
        "gateway-policy",
        "gateway-destination-ip",
        "gateway-block-page-settings",
        "gateway-extended-email-matching",
    ]),
    resourceVersion: Schema.Number,
    status: Schema.Literals(["active", "deleting", "deleted"]),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    created: "created",
    meta: "meta",
    modified: "modified",
    resourceAccountId: "resource_account_id",
    resourceId: "resource_id",
    resourceType: "resource_type",
    resourceVersion: "resource_version",
    status: "status",
}))
    .pipe(T.ResponsePath("result"));
export const deleteResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteResourceRequest,
    output: DeleteResourceResponse,
    errors: [],
}));
export const GetResourceSharingRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    includeRecipientCounts: Schema.optional(Schema.Boolean).pipe(T.HttpQuery("include_recipient_counts")),
    includeResources: Schema.optional(Schema.Boolean).pipe(T.HttpQuery("include_resources")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/shares/{shareId}" }));
export const GetResourceSharingResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    accountId: Schema.String,
    accountName: Schema.String,
    created: Schema.String,
    modified: Schema.String,
    name: Schema.String,
    organizationId: Schema.String,
    status: Schema.Literals(["active", "deleting", "deleted"]),
    targetType: Schema.Literals(["account", "organization"]),
    associatedRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    associatingRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    disassociatedRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    disassociatingRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    kind: Schema.optional(Schema.Union([Schema.Literals(["sent", "received"]), Schema.Null])),
    resources: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.String,
            created: Schema.String,
            meta: Schema.Unknown,
            modified: Schema.String,
            resourceAccountId: Schema.String,
            resourceId: Schema.String,
            resourceType: Schema.Literals([
                "custom-ruleset",
                "widget",
                "gateway-policy",
                "gateway-destination-ip",
                "gateway-block-page-settings",
                "gateway-extended-email-matching",
            ]),
            resourceVersion: Schema.Number,
            status: Schema.Literals(["active", "deleting", "deleted"]),
        }).pipe(Schema.encodeKeys({
            id: "id",
            created: "created",
            meta: "meta",
            modified: "modified",
            resourceAccountId: "resource_account_id",
            resourceId: "resource_id",
            resourceType: "resource_type",
            resourceVersion: "resource_version",
            status: "status",
        }))),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    accountId: "account_id",
    accountName: "account_name",
    created: "created",
    modified: "modified",
    name: "name",
    organizationId: "organization_id",
    status: "status",
    targetType: "target_type",
    associatedRecipientCount: "associated_recipient_count",
    associatingRecipientCount: "associating_recipient_count",
    disassociatedRecipientCount: "disassociated_recipient_count",
    disassociatingRecipientCount: "disassociating_recipient_count",
    kind: "kind",
    resources: "resources",
}))
    .pipe(T.ResponsePath("result"));
export const getResourceSharing = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetResourceSharingRequest,
    output: GetResourceSharingResponse,
    errors: [],
}));
export const ListResourceSharingsRequest = 
/*@__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")),
    direction: Schema.optional(Schema.Literals(["asc", "desc"])).pipe(T.HttpQuery("direction")),
    includeRecipientCounts: Schema.optional(Schema.Boolean).pipe(T.HttpQuery("include_recipient_counts")),
    includeResources: Schema.optional(Schema.Boolean).pipe(T.HttpQuery("include_resources")),
    kind: Schema.optional(Schema.Literals(["sent", "received"])).pipe(T.HttpQuery("kind")),
    order: Schema.optional(Schema.Literals(["name", "created"])).pipe(T.HttpQuery("order")),
    resourceTypes: Schema.optional(Schema.Array(Schema.Literals([
        "custom-ruleset",
        "widget",
        "gateway-policy",
        "gateway-destination-ip",
        "gateway-block-page-settings",
        "gateway-extended-email-matching",
    ]))).pipe(T.HttpQuery("resource_types")),
    status: Schema.optional(Schema.Literals(["active", "deleting", "deleted"])).pipe(T.HttpQuery("status")),
    targetType: Schema.optional(Schema.Literals(["account", "organization"])).pipe(T.HttpQuery("target_type")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/shares" }));
export const ListResourceSharingsResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        accountId: Schema.String,
        accountName: Schema.String,
        created: Schema.String,
        modified: Schema.String,
        name: Schema.String,
        organizationId: Schema.String,
        status: Schema.Literals(["active", "deleting", "deleted"]),
        targetType: Schema.Literals(["account", "organization"]),
        associatedRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        associatingRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        disassociatedRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        disassociatingRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        kind: Schema.optional(Schema.Union([Schema.Literals(["sent", "received"]), Schema.Null])),
        resources: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                id: Schema.String,
                created: Schema.String,
                meta: Schema.Unknown,
                modified: Schema.String,
                resourceAccountId: Schema.String,
                resourceId: Schema.String,
                resourceType: Schema.Literals([
                    "custom-ruleset",
                    "widget",
                    "gateway-policy",
                    "gateway-destination-ip",
                    "gateway-block-page-settings",
                    "gateway-extended-email-matching",
                ]),
                resourceVersion: Schema.Number,
                status: Schema.Literals(["active", "deleting", "deleted"]),
            }).pipe(Schema.encodeKeys({
                id: "id",
                created: "created",
                meta: "meta",
                modified: "modified",
                resourceAccountId: "resource_account_id",
                resourceId: "resource_id",
                resourceType: "resource_type",
                resourceVersion: "resource_version",
                status: "status",
            }))),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        accountId: "account_id",
        accountName: "account_name",
        created: "created",
        modified: "modified",
        name: "name",
        organizationId: "organization_id",
        status: "status",
        targetType: "target_type",
        associatedRecipientCount: "associated_recipient_count",
        associatingRecipientCount: "associating_recipient_count",
        disassociatedRecipientCount: "disassociated_recipient_count",
        disassociatingRecipientCount: "disassociating_recipient_count",
        kind: "kind",
        resources: "resources",
    }))),
    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 listResourceSharings = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListResourceSharingsRequest,
    output: ListResourceSharingsResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateResourceSharingRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.String,
    recipients: Schema.Array(Schema.Struct({
        accountId: Schema.optional(Schema.String),
        organizationId: Schema.optional(Schema.String),
    }).pipe(Schema.encodeKeys({
        accountId: "account_id",
        organizationId: "organization_id",
    }))),
    resources: Schema.Array(Schema.Struct({
        meta: Schema.Unknown,
        resourceAccountId: Schema.String,
        resourceId: Schema.String,
        resourceType: Schema.Literals([
            "custom-ruleset",
            "widget",
            "gateway-policy",
            "gateway-destination-ip",
            "gateway-block-page-settings",
            "gateway-extended-email-matching",
        ]),
    }).pipe(Schema.encodeKeys({
        meta: "meta",
        resourceAccountId: "resource_account_id",
        resourceId: "resource_id",
        resourceType: "resource_type",
    }))),
}).pipe(T.Http({ method: "POST", path: "/accounts/{account_id}/shares" }));
export const CreateResourceSharingResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    accountId: Schema.String,
    accountName: Schema.String,
    created: Schema.String,
    modified: Schema.String,
    name: Schema.String,
    organizationId: Schema.String,
    status: Schema.Literals(["active", "deleting", "deleted"]),
    targetType: Schema.Literals(["account", "organization"]),
    associatedRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    associatingRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    disassociatedRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    disassociatingRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    kind: Schema.optional(Schema.Union([Schema.Literals(["sent", "received"]), Schema.Null])),
    resources: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.String,
            created: Schema.String,
            meta: Schema.Unknown,
            modified: Schema.String,
            resourceAccountId: Schema.String,
            resourceId: Schema.String,
            resourceType: Schema.Literals([
                "custom-ruleset",
                "widget",
                "gateway-policy",
                "gateway-destination-ip",
                "gateway-block-page-settings",
                "gateway-extended-email-matching",
            ]),
            resourceVersion: Schema.Number,
            status: Schema.Literals(["active", "deleting", "deleted"]),
        }).pipe(Schema.encodeKeys({
            id: "id",
            created: "created",
            meta: "meta",
            modified: "modified",
            resourceAccountId: "resource_account_id",
            resourceId: "resource_id",
            resourceType: "resource_type",
            resourceVersion: "resource_version",
            status: "status",
        }))),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    accountId: "account_id",
    accountName: "account_name",
    created: "created",
    modified: "modified",
    name: "name",
    organizationId: "organization_id",
    status: "status",
    targetType: "target_type",
    associatedRecipientCount: "associated_recipient_count",
    associatingRecipientCount: "associating_recipient_count",
    disassociatedRecipientCount: "disassociated_recipient_count",
    disassociatingRecipientCount: "disassociating_recipient_count",
    kind: "kind",
    resources: "resources",
}))
    .pipe(T.ResponsePath("result"));
export const createResourceSharing = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateResourceSharingRequest,
    output: CreateResourceSharingResponse,
    errors: [],
}));
export const UpdateResourceSharingRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.String,
}).pipe(T.Http({ method: "PUT", path: "/accounts/{account_id}/shares/{shareId}" }));
export const UpdateResourceSharingResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    accountId: Schema.String,
    accountName: Schema.String,
    created: Schema.String,
    modified: Schema.String,
    name: Schema.String,
    organizationId: Schema.String,
    status: Schema.Literals(["active", "deleting", "deleted"]),
    targetType: Schema.Literals(["account", "organization"]),
    associatedRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    associatingRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    disassociatedRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    disassociatingRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    kind: Schema.optional(Schema.Union([Schema.Literals(["sent", "received"]), Schema.Null])),
    resources: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.String,
            created: Schema.String,
            meta: Schema.Unknown,
            modified: Schema.String,
            resourceAccountId: Schema.String,
            resourceId: Schema.String,
            resourceType: Schema.Literals([
                "custom-ruleset",
                "widget",
                "gateway-policy",
                "gateway-destination-ip",
                "gateway-block-page-settings",
                "gateway-extended-email-matching",
            ]),
            resourceVersion: Schema.Number,
            status: Schema.Literals(["active", "deleting", "deleted"]),
        }).pipe(Schema.encodeKeys({
            id: "id",
            created: "created",
            meta: "meta",
            modified: "modified",
            resourceAccountId: "resource_account_id",
            resourceId: "resource_id",
            resourceType: "resource_type",
            resourceVersion: "resource_version",
            status: "status",
        }))),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    accountId: "account_id",
    accountName: "account_name",
    created: "created",
    modified: "modified",
    name: "name",
    organizationId: "organization_id",
    status: "status",
    targetType: "target_type",
    associatedRecipientCount: "associated_recipient_count",
    associatingRecipientCount: "associating_recipient_count",
    disassociatedRecipientCount: "disassociated_recipient_count",
    disassociatingRecipientCount: "disassociating_recipient_count",
    kind: "kind",
    resources: "resources",
}))
    .pipe(T.ResponsePath("result"));
export const updateResourceSharing = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateResourceSharingRequest,
    output: UpdateResourceSharingResponse,
    errors: [],
}));
export const DeleteResourceSharingRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    shareId: Schema.String.pipe(T.HttpPath("shareId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/shares/{shareId}",
}));
export const DeleteResourceSharingResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    accountId: Schema.String,
    accountName: Schema.String,
    created: Schema.String,
    modified: Schema.String,
    name: Schema.String,
    organizationId: Schema.String,
    status: Schema.Literals(["active", "deleting", "deleted"]),
    targetType: Schema.Literals(["account", "organization"]),
    associatedRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    associatingRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    disassociatedRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    disassociatingRecipientCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    kind: Schema.optional(Schema.Union([Schema.Literals(["sent", "received"]), Schema.Null])),
    resources: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.String,
            created: Schema.String,
            meta: Schema.Unknown,
            modified: Schema.String,
            resourceAccountId: Schema.String,
            resourceId: Schema.String,
            resourceType: Schema.Literals([
                "custom-ruleset",
                "widget",
                "gateway-policy",
                "gateway-destination-ip",
                "gateway-block-page-settings",
                "gateway-extended-email-matching",
            ]),
            resourceVersion: Schema.Number,
            status: Schema.Literals(["active", "deleting", "deleted"]),
        }).pipe(Schema.encodeKeys({
            id: "id",
            created: "created",
            meta: "meta",
            modified: "modified",
            resourceAccountId: "resource_account_id",
            resourceId: "resource_id",
            resourceType: "resource_type",
            resourceVersion: "resource_version",
            status: "status",
        }))),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    accountId: "account_id",
    accountName: "account_name",
    created: "created",
    modified: "modified",
    name: "name",
    organizationId: "organization_id",
    status: "status",
    targetType: "target_type",
    associatedRecipientCount: "associated_recipient_count",
    associatingRecipientCount: "associating_recipient_count",
    disassociatedRecipientCount: "disassociated_recipient_count",
    disassociatingRecipientCount: "disassociating_recipient_count",
    kind: "kind",
    resources: "resources",
}))
    .pipe(T.ResponsePath("result"));
export const deleteResourceSharing = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteResourceSharingRequest,
    output: DeleteResourceSharingResponse,
    errors: [],
}));
//# sourceMappingURL=resource-sharing.js.map