"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.taskWithIdSchema = exports.taskSchema = void 0;
const zod_1 = require("zod");
const reference_zod_1 = require("./reference.zod");
const extensions_core_1 = require("@awell-health/extensions-core");
const extensionSchema = zod_1.z.object({
    url: zod_1.z.string(),
    valueReference: zod_1.z.object({
        reference: zod_1.z.string().optional(),
        display: zod_1.z.string().optional(),
    }),
});
exports.taskSchema = zod_1.z.object({
    resourceType: zod_1.z.literal('Task'),
    extension: zod_1.z.array(extensionSchema).optional(),
    status: zod_1.z.enum([
        'draft',
        'requested',
        'received',
        'accepted',
        'rejected',
        'ready',
        'cancelled',
        'in-progress',
        'on-hold',
        'failed',
        'completed',
        'entered-in-error',
    ]),
    requester: zod_1.z.object({
        reference: (0, reference_zod_1.createReferenceSchema)('Practitioner'),
    }),
    description: zod_1.z.string().optional(),
    for: zod_1.z.object({
        reference: (0, reference_zod_1.createReferenceSchema)('Patient'),
    }),
    owner: zod_1.z
        .object({
        reference: (0, reference_zod_1.createReferenceSchema)('Practitioner'),
    })
        .optional(),
    authoredOn: extensions_core_1.DateTimeSchema.optional(),
    restriction: zod_1.z
        .object({
        period: zod_1.z.object({
            end: extensions_core_1.DateTimeSchema,
        }),
    })
        .optional(),
    note: zod_1.z
        .array(zod_1.z.object({
        text: zod_1.z.string(),
        time: extensions_core_1.DateTimeSchema,
        authorReference: zod_1.z.object({
            reference: (0, reference_zod_1.createReferenceSchema)('Practitioner'),
        }),
    }))
        .optional(),
    input: zod_1.z
        .array(zod_1.z.object({
        type: zod_1.z.object({
            text: zod_1.z.string(),
        }),
        valueString: zod_1.z.string(),
    }))
        .optional(),
});
exports.taskWithIdSchema = exports.taskSchema.extend({
    id: zod_1.z.string(),
});
//# sourceMappingURL=task.zod.js.map