/**
 * Cloudflare REGISTRAR API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service registrar
 */
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 GetDomainRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    domainName: Schema.String.pipe(T.HttpPath("domainName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/registrar/domains/{domainName}",
}));
export const GetDomainResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Unknown.pipe(T.ResponsePath("result"));
export const getDomain = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetDomainRequest,
    output: GetDomainResponse,
    errors: [],
}));
export const ListDomainsRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/registrar/domains" }));
export const ListDomainsResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        available: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        canRegister: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        currentRegistrar: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        expiresAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        locked: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        registrantContact: Schema.optional(Schema.Union([
            Schema.Struct({
                address: Schema.String,
                city: Schema.String,
                country: Schema.Union([Schema.String, Schema.Null]),
                firstName: Schema.Union([Schema.String, Schema.Null]),
                lastName: Schema.Union([Schema.String, Schema.Null]),
                organization: Schema.String,
                phone: Schema.Union([Schema.String, Schema.Null]),
                state: Schema.String,
                zip: Schema.Union([Schema.String, Schema.Null]),
                id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                address2: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                fax: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            }).pipe(Schema.encodeKeys({
                address: "address",
                city: "city",
                country: "country",
                firstName: "first_name",
                lastName: "last_name",
                organization: "organization",
                phone: "phone",
                state: "state",
                zip: "zip",
                id: "id",
                address2: "address2",
                email: "email",
                fax: "fax",
            })),
            Schema.Null,
        ])),
        registryStatuses: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        supportedTld: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        transferIn: Schema.optional(Schema.Union([
            Schema.Struct({
                acceptFoa: Schema.optional(Schema.Union([
                    Schema.Union([
                        Schema.Literals(["needed", "ok"]),
                        Schema.String,
                    ]),
                    Schema.Null,
                ])),
                approveTransfer: Schema.optional(Schema.Union([
                    Schema.Union([
                        Schema.Literals([
                            "needed",
                            "ok",
                            "pending",
                            "trying",
                            "rejected",
                            "unknown",
                        ]),
                        Schema.String,
                    ]),
                    Schema.Null,
                ])),
                canCancelTransfer: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                disablePrivacy: Schema.optional(Schema.Union([
                    Schema.Union([
                        Schema.Literals(["needed", "ok", "unknown"]),
                        Schema.String,
                    ]),
                    Schema.Null,
                ])),
                enterAuthCode: Schema.optional(Schema.Union([
                    Schema.Union([
                        Schema.Literals([
                            "needed",
                            "ok",
                            "pending",
                            "trying",
                            "rejected",
                        ]),
                        Schema.String,
                    ]),
                    Schema.Null,
                ])),
                unlockDomain: Schema.optional(Schema.Union([
                    Schema.Union([
                        Schema.Literals([
                            "needed",
                            "ok",
                            "pending",
                            "trying",
                            "unknown",
                        ]),
                        Schema.String,
                    ]),
                    Schema.Null,
                ])),
            }).pipe(Schema.encodeKeys({
                acceptFoa: "accept_foa",
                approveTransfer: "approve_transfer",
                canCancelTransfer: "can_cancel_transfer",
                disablePrivacy: "disable_privacy",
                enterAuthCode: "enter_auth_code",
                unlockDomain: "unlock_domain",
            })),
            Schema.Null,
        ])),
        updatedAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        available: "available",
        canRegister: "can_register",
        createdAt: "created_at",
        currentRegistrar: "current_registrar",
        expiresAt: "expires_at",
        locked: "locked",
        registrantContact: "registrant_contact",
        registryStatuses: "registry_statuses",
        supportedTld: "supported_tld",
        transferIn: "transfer_in",
        updatedAt: "updated_at",
    }))),
});
export const listDomains = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListDomainsRequest,
    output: ListDomainsResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const PutDomainRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    domainName: Schema.String.pipe(T.HttpPath("domainName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    autoRenew: Schema.optional(Schema.Boolean),
    locked: Schema.optional(Schema.Boolean),
    privacy: Schema.optional(Schema.Boolean),
}).pipe(Schema.encodeKeys({
    autoRenew: "auto_renew",
    locked: "locked",
    privacy: "privacy",
}), T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/registrar/domains/{domainName}",
}));
export const PutDomainResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Unknown.pipe(T.ResponsePath("result"));
export const putDomain = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: PutDomainRequest,
    output: PutDomainResponse,
    errors: [],
}));
export const CheckRegistrarRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    domains: Schema.Array(Schema.String),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/registrar/domain-check",
}));
export const CheckRegistrarResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    domains: Schema.Array(Schema.Struct({
        name: Schema.String,
        registrable: Schema.Boolean,
        pricing: Schema.optional(Schema.Union([
            Schema.Struct({
                currency: Schema.String,
                registrationCost: Schema.String,
                renewalCost: Schema.String,
            }).pipe(Schema.encodeKeys({
                currency: "currency",
                registrationCost: "registration_cost",
                renewalCost: "renewal_cost",
            })),
            Schema.Null,
        ])),
        reason: Schema.optional(Schema.Union([
            Schema.Union([
                Schema.Literals([
                    "extension_not_supported_via_api",
                    "extension_not_supported",
                    "extension_disallows_registration",
                    "domain_premium",
                    "domain_unavailable",
                ]),
                Schema.String,
            ]),
            Schema.Null,
        ])),
        tier: Schema.optional(Schema.Union([
            Schema.Union([
                Schema.Literals(["standard", "premium"]),
                Schema.String,
            ]),
            Schema.Null,
        ])),
    })),
}).pipe(T.ResponsePath("result"));
export const checkRegistrar = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CheckRegistrarRequest,
    output: CheckRegistrarResponse,
    errors: [],
}));
export const SearchRegistrarRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    q: Schema.String.pipe(T.HttpQuery("q")),
    extensions: Schema.optional(Schema.Array(Schema.String)).pipe(T.HttpQuery("extensions")),
    limit: Schema.optional(Schema.Number).pipe(T.HttpQuery("limit")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/registrar/domain-search",
}));
export const SearchRegistrarResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    domains: Schema.Array(Schema.Struct({
        name: Schema.String,
        registrable: Schema.Boolean,
        pricing: Schema.optional(Schema.Union([
            Schema.Struct({
                currency: Schema.String,
                registrationCost: Schema.String,
                renewalCost: Schema.String,
            }).pipe(Schema.encodeKeys({
                currency: "currency",
                registrationCost: "registration_cost",
                renewalCost: "renewal_cost",
            })),
            Schema.Null,
        ])),
        reason: Schema.optional(Schema.Union([
            Schema.Union([
                Schema.Literals([
                    "extension_not_supported_via_api",
                    "extension_not_supported",
                    "extension_disallows_registration",
                    "domain_premium",
                    "domain_unavailable",
                ]),
                Schema.String,
            ]),
            Schema.Null,
        ])),
        tier: Schema.optional(Schema.Union([
            Schema.Union([
                Schema.Literals(["standard", "premium"]),
                Schema.String,
            ]),
            Schema.Null,
        ])),
    })),
}).pipe(T.ResponsePath("result"));
export const searchRegistrar = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: SearchRegistrarRequest,
    output: SearchRegistrarResponse,
    errors: [],
}));
export const GetRegistrationStatusRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    domainName: Schema.String.pipe(T.HttpPath("domainName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/registrar/registrations/{domainName}/registration-status",
}));
export const GetRegistrationStatusResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    completed: Schema.Boolean,
    createdAt: Schema.String,
    links: Schema.Struct({
        self: Schema.String,
        resource: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }),
    state: Schema.Union([
        Schema.Literals([
            "pending",
            "in_progress",
            "action_required",
            "blocked",
            "succeeded",
            "failed",
        ]),
        Schema.String,
    ]),
    updatedAt: Schema.String,
    context: Schema.optional(Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.Null])),
    error: Schema.optional(Schema.Union([
        Schema.Struct({
            code: Schema.String,
            message: Schema.String,
        }),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    completed: "completed",
    createdAt: "created_at",
    links: "links",
    state: "state",
    updatedAt: "updated_at",
    context: "context",
    error: "error",
}))
    .pipe(T.ResponsePath("result"));
export const getRegistrationStatus = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetRegistrationStatusRequest,
    output: GetRegistrationStatusResponse,
    errors: [],
}));
export const GetUpdateStatusRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    domainName: Schema.String.pipe(T.HttpPath("domainName")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/registrar/registrations/{domainName}/update-status",
}));
export const GetUpdateStatusResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    completed: Schema.Boolean,
    createdAt: Schema.String,
    links: Schema.Struct({
        self: Schema.String,
        resource: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }),
    state: Schema.Union([
        Schema.Literals([
            "pending",
            "in_progress",
            "action_required",
            "blocked",
            "succeeded",
            "failed",
        ]),
        Schema.String,
    ]),
    updatedAt: Schema.String,
    context: Schema.optional(Schema.Union([Schema.Record(Schema.String, Schema.Unknown), Schema.Null])),
    error: Schema.optional(Schema.Union([
        Schema.Struct({
            code: Schema.String,
            message: Schema.String,
        }),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    completed: "completed",
    createdAt: "created_at",
    links: "links",
    state: "state",
    updatedAt: "updated_at",
    context: "context",
    error: "error",
}))
    .pipe(T.ResponsePath("result"));
export const getUpdateStatus = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetUpdateStatusRequest,
    output: GetUpdateStatusResponse,
    errors: [],
}));
//# sourceMappingURL=registrar.js.map