import { BaseOpenApiV3_1ConverterNodeWithExample, } from "../../../BaseOpenApiV3_1Converter.node";
export class BooleanConverterNode extends BaseOpenApiV3_1ConverterNodeWithExample {
    default;
    nullable;
    constructor(args) {
        super(args);
        this.nullable = args.nullable;
        this.safeParse();
    }
    parse() {
        if (this.input.default != null && typeof this.input.default !== "boolean") {
            this.context.errors.warning({
                message: `Expected default value to be a boolean. Received ${this.input.default}`,
                path: this.accessPath,
            });
        }
        this.default = this.input.default;
    }
    convert() {
        return {
            type: "alias",
            value: {
                type: "primitive",
                value: {
                    type: "boolean",
                    default: this.default,
                },
            },
        };
    }
    example() {
        return (this.input.example ??
            this.input.examples?.[0] ??
            this.default ??
            (this.nullable ? null : false));
    }
}
