"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.RobotArmMutation = void 0;
const type_graphql_1 = require("type-graphql");
const robotarm_type_1 = require("./robotarm-type");
const robot_arm_api_1 = require("../../controllers/robot-arm-api");
// extend type Mutation {
//   robotArmReset(name: String!): Boolean
//   robotArmGoHome(name: String!): Boolean
//   robotArmGoZero(name: String!): Boolean
//   robotArmTaskMoveTo(name: String!, pose: PoseInput!): Pose
//   robotArmTaskMoveBy(name: String!, pose: PoseInput!): Pose
//   robotArmTaskMoveByNoWait(name: String!, pose: PoseInput!): Pose
//   robotArmStartTeachingMode(name: String!): Boolean
//   robotArmFinishTeachingMode(name: String!): Boolean
//   robotArmJointMoveTo(name: String!, joints: JointsInput!): Joints
//   robotArmSetHome(name: String!, joints: JointsInput!): Joints
// }
let RobotArmMutation = class RobotArmMutation {
    async robotArmReset(name, context) {
        const { domain } = context.state;
        return robot_arm_api_1.RobotArmAPI.reset(domain, name);
    }
    async robotArmGoHome(name, context) {
        const { domain } = context.state;
        return robot_arm_api_1.RobotArmAPI.goHome(domain, name);
    }
    async robotArmGoZero(name, context) {
        const { domain } = context.state;
        return robot_arm_api_1.RobotArmAPI.goZero(domain, name);
    }
    async robotArmTaskMoveTo(name, pose, context) {
        const { domain } = context.state;
        return robot_arm_api_1.RobotArmAPI.moveTo(domain, name, { pose });
    }
    async robotArmTaskMoveBy(name, pose, context) {
        const { domain } = context.state;
        return robot_arm_api_1.RobotArmAPI.moveBy(domain, name, { pose });
    }
    async robotArmTaskMoveByNoWait(name, pose, context) {
        const { domain } = context.state;
        return robot_arm_api_1.RobotArmAPI.moveByNoWait(domain, name, { pose });
    }
    async robotArmStartTeachingMode(name, context) {
        const { domain } = context.state;
        return robot_arm_api_1.RobotArmAPI.startTeachingMode(domain, name);
    }
    async robotArmFinishTeachingMode(name, context) {
        const { domain } = context.state;
        return robot_arm_api_1.RobotArmAPI.finishTeachingMode(domain, name);
    }
    async robotArmJointMoveTo(name, joints, context) {
        const { domain } = context.state;
        return robot_arm_api_1.RobotArmAPI.moveToJoints(domain, name, { joints });
    }
    async robotArmSetHome(name, joints, context) {
        const { domain } = context.state;
        return robot_arm_api_1.RobotArmAPI.setHome(domain, name, { joints });
    }
};
__decorate([
    (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To run reset command of the robot' }),
    __param(0, (0, type_graphql_1.Arg)('name', type => String, { nullable: false })),
    __param(1, (0, type_graphql_1.Ctx)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", Promise)
], RobotArmMutation.prototype, "robotArmReset", null);
__decorate([
    (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To run goHome command of the robot' }),
    __param(0, (0, type_graphql_1.Arg)('name', type => String, { nullable: false })),
    __param(1, (0, type_graphql_1.Ctx)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", Promise)
], RobotArmMutation.prototype, "robotArmGoHome", null);
__decorate([
    (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To run goZero command of the robot' }),
    __param(0, (0, type_graphql_1.Arg)('name', type => String, { nullable: false })),
    __param(1, (0, type_graphql_1.Ctx)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", Promise)
], RobotArmMutation.prototype, "robotArmGoZero", null);
__decorate([
    (0, type_graphql_1.Mutation)(returns => robotarm_type_1.Pose, { description: 'To run taskMoveTo command of the robot' }),
    __param(0, (0, type_graphql_1.Arg)('name', type => String, { nullable: false })),
    __param(1, (0, type_graphql_1.Arg)('pose', type => robotarm_type_1.PoseInput, { nullable: false })),
    __param(2, (0, type_graphql_1.Ctx)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, robotarm_type_1.Pose, Object]),
    __metadata("design:returntype", Promise)
], RobotArmMutation.prototype, "robotArmTaskMoveTo", null);
__decorate([
    (0, type_graphql_1.Mutation)(returns => robotarm_type_1.Pose, { description: 'To run taskMoveBy command of the robot' }),
    __param(0, (0, type_graphql_1.Arg)('name', type => String, { nullable: false })),
    __param(1, (0, type_graphql_1.Arg)('pose', type => robotarm_type_1.PoseInput, { nullable: false })),
    __param(2, (0, type_graphql_1.Ctx)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, robotarm_type_1.Pose, Object]),
    __metadata("design:returntype", Promise)
], RobotArmMutation.prototype, "robotArmTaskMoveBy", null);
__decorate([
    (0, type_graphql_1.Mutation)(returns => robotarm_type_1.Pose, { description: 'To run taskMoveBy command of the robot' }),
    __param(0, (0, type_graphql_1.Arg)('name', type => String, { nullable: false })),
    __param(1, (0, type_graphql_1.Arg)('pose', type => robotarm_type_1.PoseInput, { nullable: false })),
    __param(2, (0, type_graphql_1.Ctx)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, robotarm_type_1.Pose, Object]),
    __metadata("design:returntype", Promise)
], RobotArmMutation.prototype, "robotArmTaskMoveByNoWait", null);
__decorate([
    (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To start teaching mode of the robot' }),
    __param(0, (0, type_graphql_1.Arg)('name', type => String, { nullable: false })),
    __param(1, (0, type_graphql_1.Ctx)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", Promise)
], RobotArmMutation.prototype, "robotArmStartTeachingMode", null);
__decorate([
    (0, type_graphql_1.Mutation)(returns => Boolean, { description: 'To stop teaching mode of the robot' }),
    __param(0, (0, type_graphql_1.Arg)('name', type => String, { nullable: false })),
    __param(1, (0, type_graphql_1.Ctx)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, Object]),
    __metadata("design:returntype", Promise)
], RobotArmMutation.prototype, "robotArmFinishTeachingMode", null);
__decorate([
    (0, type_graphql_1.Mutation)(returns => robotarm_type_1.Joints, { description: 'To run jointMoveTo command of the robot' }),
    __param(0, (0, type_graphql_1.Arg)('name', type => String, { nullable: false })),
    __param(1, (0, type_graphql_1.Arg)('joints', type => robotarm_type_1.JointsInput, { nullable: false })),
    __param(2, (0, type_graphql_1.Ctx)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, robotarm_type_1.Joints, Object]),
    __metadata("design:returntype", Promise)
], RobotArmMutation.prototype, "robotArmJointMoveTo", null);
__decorate([
    (0, type_graphql_1.Mutation)(returns => robotarm_type_1.Joints, { description: 'To set the home position of the robot' }),
    __param(0, (0, type_graphql_1.Arg)('name', type => String, { nullable: false })),
    __param(1, (0, type_graphql_1.Arg)('joints', type => robotarm_type_1.JointsInput, { nullable: false })),
    __param(2, (0, type_graphql_1.Ctx)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, robotarm_type_1.Joints, Object]),
    __metadata("design:returntype", Promise)
], RobotArmMutation.prototype, "robotArmSetHome", null);
RobotArmMutation = __decorate([
    (0, type_graphql_1.Resolver)(robotarm_type_1.RobotArm)
], RobotArmMutation);
exports.RobotArmMutation = RobotArmMutation;
//# sourceMappingURL=robotarm-mutation.js.map