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); }
};
import { Ctx, Field, Int, ObjectType, PubSub, PubSubEngine, Query, Resolver, Root, Subscription } from 'type-graphql';
import { Public } from '../directives/index.js';
let Color = class Color {
    ID;
    name;
    createdZ;
};
__decorate([
    Field(() => Int),
    Public(),
    __metadata("design:type", Number)
], Color.prototype, "ID", void 0);
__decorate([
    Field(() => String),
    Public(),
    __metadata("design:type", String)
], Color.prototype, "name", void 0);
__decorate([
    Field(() => String),
    Public(),
    __metadata("design:type", String)
], Color.prototype, "createdZ", void 0);
Color = __decorate([
    ObjectType()
], Color);
export { Color };
let ColorNotification = class ColorNotification {
    message;
    date;
};
__decorate([
    Public(),
    Field(() => String, { nullable: true }),
    __metadata("design:type", String)
], ColorNotification.prototype, "message", void 0);
__decorate([
    Public(),
    Field((_type) => Date),
    __metadata("design:type", Date)
], ColorNotification.prototype, "date", void 0);
ColorNotification = __decorate([
    ObjectType()
], ColorNotification);
export { ColorNotification };
let ColorResolver = class ColorResolver {
    colorSubscription({ message }) {
        return { message, date: new Date() };
    }
    async colors(_ctx, pubSub) {
        const createdZ = new Date().toISOString();
        pubSub.publish('COLOR', {
            message: 'Colors were requested!',
        });
        return [
            { ID: 1, name: 'Red', createdZ },
            { ID: 2, name: 'Orange', createdZ },
            { ID: 3, name: 'Yellow', createdZ },
            { ID: 4, name: 'Green', createdZ },
            { ID: 5, name: 'Blue', createdZ },
            { ID: 6, name: 'Purple', createdZ },
        ];
    }
};
__decorate([
    Subscription(() => ColorNotification, { topics: 'COLOR' }),
    Public(),
    __param(0, Root()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", ColorNotification)
], ColorResolver.prototype, "colorSubscription", null);
__decorate([
    Query(() => [Color]),
    Public(),
    __param(0, Ctx()),
    __param(1, PubSub()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object, PubSubEngine]),
    __metadata("design:returntype", Promise)
], ColorResolver.prototype, "colors", null);
ColorResolver = __decorate([
    Resolver(Color)
], ColorResolver);
export { ColorResolver };
//# sourceMappingURL=ColorResolver.js.map