"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PublicRecruitmentController = void 0;
const common_1 = require("@nestjs/common");
const zod_validation_pipe_1 = require("../../common/pipes/zod-validation.pipe");
const api_key_guard_1 = require("./api-key.guard");
const recruitment_dto_1 = require("./recruitment.dto");
const recruitment_service_1 = require("./recruitment.service");
let PublicRecruitmentController = class PublicRecruitmentController {
    constructor(service) {
        this.service = service;
    }
    async getPublicJobs(orgSlug, res) {
        const result = await this.service.getPublicJobs(orgSlug);
        return res.status(result.status).json(result);
    }
    async getPublicJob(orgSlug, jobSlug, res) {
        const result = await this.service.getPublicJob(orgSlug, jobSlug);
        return res.status(result.status).json(result);
    }
    async publicApply(orgSlug, jobSlug, data, res) {
        const result = await this.service.publicApply(orgSlug, jobSlug, data);
        return res.status(result.status).json(result);
    }
    async publicApiJobs(req, res) {
        const result = await this.service.publicApiListJobs(req.tenantOwnerId);
        return res.status(result.status).json(result);
    }
    async publicApiApply(req, body, res) {
        const result = await this.service.publicApiCreateApplication(req.tenantOwnerId, body);
        return res.status(result.status).json(result);
    }
    async getTaskByToken(token, res) {
        const result = await this.service.getTaskByToken(token);
        return res.status(result.status).json(result);
    }
    async submitTaskByToken(token, data, res) {
        const result = await this.service.submitTaskByToken(token, data);
        return res.status(result.status).json(result);
    }
};
exports.PublicRecruitmentController = PublicRecruitmentController;
__decorate([
    (0, common_1.Get)('careers/:orgSlug/jobs'),
    __param(0, (0, common_1.Param)('orgSlug')),
    __param(1, (0, common_1.Res)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", Promise)
], PublicRecruitmentController.prototype, "getPublicJobs", null);
__decorate([
    (0, common_1.Get)('careers/:orgSlug/jobs/:jobSlug'),
    __param(0, (0, common_1.Param)('orgSlug')),
    __param(1, (0, common_1.Param)('jobSlug')),
    __param(2, (0, common_1.Res)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String, Object]),
    __metadata("design:returntype", Promise)
], PublicRecruitmentController.prototype, "getPublicJob", null);
__decorate([
    (0, common_1.UsePipes)(new zod_validation_pipe_1.ZodValidationPipe(recruitment_dto_1.publicApplySchema)),
    (0, common_1.Post)('careers/:orgSlug/jobs/:jobSlug/apply'),
    __param(0, (0, common_1.Param)('orgSlug')),
    __param(1, (0, common_1.Param)('jobSlug')),
    __param(2, (0, common_1.Body)()),
    __param(3, (0, common_1.Res)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String, Object, Object]),
    __metadata("design:returntype", Promise)
], PublicRecruitmentController.prototype, "publicApply", null);
__decorate([
    (0, common_1.UseGuards)(api_key_guard_1.ApiKeyGuard),
    (0, common_1.Get)('v1/jobs'),
    __param(0, (0, common_1.Req)()),
    __param(1, (0, common_1.Res)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object]),
    __metadata("design:returntype", Promise)
], PublicRecruitmentController.prototype, "publicApiJobs", null);
__decorate([
    (0, common_1.UseGuards)(api_key_guard_1.ApiKeyGuard),
    (0, common_1.UsePipes)(new zod_validation_pipe_1.ZodValidationPipe(recruitment_dto_1.publicApiApplySchema)),
    (0, common_1.Post)('v1/applications'),
    __param(0, (0, common_1.Req)()),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, common_1.Res)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, Object, Object]),
    __metadata("design:returntype", Promise)
], PublicRecruitmentController.prototype, "publicApiApply", null);
__decorate([
    (0, common_1.Get)('recruitment-tasks/:token'),
    __param(0, (0, common_1.Param)('token')),
    __param(1, (0, common_1.Res)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", Promise)
], PublicRecruitmentController.prototype, "getTaskByToken", null);
__decorate([
    (0, common_1.UsePipes)(new zod_validation_pipe_1.ZodValidationPipe(recruitment_dto_1.submitRecruitmentTaskSchema)),
    (0, common_1.Post)('recruitment-tasks/:token/submit'),
    __param(0, (0, common_1.Param)('token')),
    __param(1, (0, common_1.Body)()),
    __param(2, (0, common_1.Res)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object, Object]),
    __metadata("design:returntype", Promise)
], PublicRecruitmentController.prototype, "submitTaskByToken", null);
exports.PublicRecruitmentController = PublicRecruitmentController = __decorate([
    (0, common_1.Controller)('public'),
    __metadata("design:paramtypes", [recruitment_service_1.RecruitmentService])
], PublicRecruitmentController);
//# sourceMappingURL=public-recruitment.controller.js.map