import { operation, buildingBase, buildingCommonMethods, buildingView, requestBodySchema, response200, response500, security, statusSchema, tags, } from '../../chunks.ts'; const base = buildingBase('TheDillonForge'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' } }, }); const tasksSchema = { type: 'object', properties: { current_task: { type: 'string' }, seconds_remaining: { type: 'integer' }, can: { type: 'integer', enum: [1, 0] }, working: { type: 'string' }, subsidy_cost: { type: 'integer' }, make_plan: { type: 'array', items: { type: 'object', properties: { name: { type: 'string' }, max_level: { type: 'integer' }, class: { type: 'string' }, reset_sec_per_level: { type: 'integer' }, }, }, }, split_plan: { type: 'array', items: { type: 'object', properties: { name: { type: 'string' }, class: { type: 'string' }, level: { type: 'integer' }, extra_build_level: { type: 'integer' }, fail_chance: { type: 'integer' }, reset_seconds: { type: 'integer' }, }, }, }, }, }; export const theDillonForge = { ...buildingCommonMethods(base), ...buildingView(base, { tasks: tasksSchema }), [`${base}/make_plan`]: { post: { ...tags(base), ...security(), ...operation('Make plan.', 'Starts making a plan. Returns the building view.'), ...requestBodySchema({ type: 'object', required: ['building_id', 'plan_class', 'level'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, plan_class: { type: 'string', description: "The plan's class, as returned by view's tasks > make_plan.", }, level: { type: 'integer', description: 'The level to build the plan at. Cannot exceed the level of The Dillon Forge. Requires at least 2x level 1+0 plans of the specified class on the colony to build a level x+0 plan.', }, }, }), responses: { ...response200('Starts making a plan. Returns the building view.', { type: 'object', required: ['building', 'status'], properties: { building: { $ref: '#/components/schemas/building' }, status: statusSchema(), }, }), ...response500(), }, }, }, [`${base}/split_plan`]: { post: { ...tags(base), ...security(), ...operation( 'Split plan.', 'Splits a plan into its constituent glyphs. Returns the building view.' ), ...requestBodySchema({ type: 'object', required: ['building_id', 'plan_class', 'level', 'quantity'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' }, plan_class: { type: 'string', description: "The plan's class, as returned by view's tasks > split_plan.", }, level: { type: 'integer', description: 'The level of the plan to split.' }, extra_build_level: { type: 'integer', description: "The plan's extra build levels, if any.", }, quantity: { type: 'integer', description: 'Number of plans to feed into the forge. Time does not scale linearly — more plans is more efficient.', }, }, }), responses: { ...response200('Splits a plan into its constituent glyphs. Returns the building view.', { type: 'object', required: ['building', 'status'], properties: { building: { $ref: '#/components/schemas/building' }, status: statusSchema(), }, }), ...response500(), }, }, }, [`${base}/subsidize`]: { post: { ...tags(base), ...security(), ...operation( 'Subsidize the current forge task.', 'Spends essentia to complete the current task immediately (2e, unless splitting multiple plans). Returns the building view. Throws 1011.' ), ...buildingIdRequestBody, responses: { ...response200( 'Spends essentia to complete the current task immediately (2e, unless splitting multiple plans). Returns the building view. Throws 1011.', { type: 'object', required: ['building', 'status'], properties: { building: { $ref: '#/components/schemas/building' }, status: statusSchema(), }, } ), ...response500(), }, }, }, };