import { operation, buildingBase, buildingCommonMethods, buildingView, requestBodySchema, response200, response500, security, statusSchema, tags, } from '../../chunks.ts'; const base = buildingBase('PlanetaryCommand'); const buildingIdRequestBody = requestBodySchema({ type: 'object', required: ['building_id'], properties: { building_id: { type: 'integer', description: 'The unique id of the building.' } }, }); export const planetaryCommand = { ...buildingCommonMethods(base), ...buildingView(base, { next_colony_cost: { type: 'integer', description: 'Happiness required to settle the next colony.', }, food: { type: 'object', description: 'Hourly rate and stored amount, keyed by food type (algae, bean, etc).', additionalProperties: { type: 'integer' }, }, ore: { type: 'object', description: 'Hourly rate and stored amount, keyed by ore type.', additionalProperties: { type: 'integer' }, }, pod_delay: { type: 'integer', description: 'Seconds between supply pods being sent.' }, planet: { $ref: '#/components/schemas/planet_status' }, }), [`${base}/view_plans`]: { post: { ...tags(base), ...security(), ...operation('View plans.', 'Lists all building plans this empire has collected.'), ...buildingIdRequestBody, responses: { ...response200('Lists all building plans this empire has collected.', { type: 'object', required: ['plans', 'status'], properties: { plans: { type: 'array', items: { type: 'object', properties: { quantity: { type: 'integer' }, name: { type: 'string' }, level: { type: 'integer' }, extra_build_level: { type: 'integer' }, }, }, }, status: statusSchema(), }, }), ...response500(), }, }, }, [`${base}/view_incoming_supply_chains`]: { post: { ...tags(base), ...security(), ...operation( 'View incoming supply chains.', 'Lists supply chains feeding resources into this planet.' ), ...buildingIdRequestBody, responses: { ...response200('Lists supply chains feeding resources into 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(), }, }, }, [`${base}/subsidize_pod_cooldown`]: { post: { ...tags(base), ...security(), ...operation( 'Subsidize pod cooldown.', 'Spends 2 essentia to send a supply pod immediately. Returns the building view. Throws 1011.' ), ...buildingIdRequestBody, responses: { ...response200( 'Spends 2 essentia to send a supply pod immediately. Returns the building view. Throws 1011.', { type: 'object', required: ['building', 'status'], properties: { building: { $ref: '#/components/schemas/building' }, status: statusSchema(), }, } ), ...response500(), }, }, }, };