import { operation, buildingBase, requestBodySchema, response200, response500, security, statusSchema, tags, } from '../../chunks.ts'; const base = buildingBase('StationCommand'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' } }, }); // StationCommand.pod's `planet` block on `view` documents the space station's own body/resource // status — the shared planet_status shape (see src/spec/components.ts). const planetSchema = { $ref: '#/components/schemas/planet_status' }; // Station Command Center. StationCommand.pod: "Command extends the view method to include a // `planet` section" plus `next_colony_cost`. export const stationCommand = { [`${base}/view`]: { post: { ...tags(base), ...security(), ...operation( "Retrieve this module's properties and planet data.", "Retrieves the properties of this module, plus the station's own planet data." ), ...buildingIdRequestBody, responses: { ...response200( "Retrieves the properties of this module, plus the station's own planet data.", { type: 'object', required: ['building', 'status', 'next_colony_cost', 'planet'], properties: { building: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' }, image: { type: 'string' }, level: { type: 'integer' }, x: { type: 'integer' }, y: { type: 'integer' }, efficiency: { type: 'integer' }, }, required: ['id', 'name', 'image', 'level', 'x', 'y', 'efficiency'], }, next_colony_cost: { type: 'integer', description: 'The amount of happiness required to settle your next colony.', }, planet: planetSchema, status: statusSchema(), }, } ), ...response500(), }, }, }, [`${base}/view_plans`]: { post: { ...tags(base), ...security(), ...operation('View plans.', 'Returns a list of all the plans this empire has collected.'), ...buildingIdRequestBody, responses: { ...response200('Returns a list of all the plans this empire has collected.', { type: 'object', required: ['plans', 'status'], properties: { plans: { type: 'array', items: { type: 'object', properties: { name: { type: 'string' }, level: { type: 'integer' }, extra_build_level: { type: 'integer', description: 'If level is 1 and this is present, the building will be built up to 1 plus this value when complete.', }, }, required: ['name', 'level'], }, }, status: statusSchema(), }, }), ...response500(), }, }, }, [`${base}/view_incoming_supply_chains`]: { post: { ...tags(base), ...security(), ...operation( 'View incoming supply chains.', 'Returns a list of all incoming supply chains feeding this planet.' ), ...buildingIdRequestBody, responses: { ...response200('Returns a list of all incoming supply chains feeding this planet.', { type: 'object', required: ['supply_chains', 'status'], properties: { supply_chains: { type: 'array', items: { type: 'object', properties: { id: { type: 'integer' }, from_body: { type: 'object', properties: { id: { type: 'integer' }, name: { type: 'string' }, x: { type: 'integer' }, y: { type: 'integer' }, image: { type: 'string' }, }, }, resource_hour: { type: 'integer' }, resource_type: { type: 'string' }, percent_transferred: { type: 'number' }, stalled: { type: 'integer', enum: [1, 0] }, }, }, }, status: statusSchema(), }, }), ...response500(), }, }, }, };