{"lexicon":1,"id":"money.atmosphere.billing.requestKofiMigrationBatch","defs":{"previewSummary":{"type":"object","required":["source","totalRows","validRows","activeRows","missingEmailRows","duplicateEmailRows","totalAmount","currencies","tierCount"],"properties":{"source":{"type":"string","knownValues":["kofi","substack"],"maxLength":32},"totalRows":{"type":"integer","minimum":0},"validRows":{"type":"integer","minimum":0},"activeRows":{"type":"integer","minimum":0},"stripeRows":{"type":"integer","minimum":0,"description":"Rows whose source payment method was Stripe. Optional: a future source may not distinguish payment methods."},"paypalRows":{"type":"integer","minimum":0,"description":"Rows whose source payment method was PayPal. Optional: a future source may not distinguish payment methods."},"unknownPaymentMethodRows":{"type":"integer","minimum":0},"missingEmailRows":{"type":"integer","minimum":0},"duplicateEmailRows":{"type":"integer","minimum":0},"totalAmount":{"type":"integer","minimum":0},"currencies":{"type":"array","maxLength":20,"items":{"type":"string","minLength":3,"maxLength":3}},"tierCount":{"type":"integer","minimum":0}}},"tierSummary":{"type":"object","required":["tierName","rowCount","activeCount","totalAmount","currencies"],"properties":{"tierName":{"type":"string","maxGraphemes":120,"maxLength":512},"rowCount":{"type":"integer","minimum":0},"activeCount":{"type":"integer","minimum":0},"stripeCount":{"type":"integer","minimum":0,"description":"Rows in this tier whose source payment method was Stripe. Optional: a future source may not distinguish payment methods."},"paypalCount":{"type":"integer","minimum":0,"description":"Rows in this tier whose source payment method was PayPal. Optional: a future source may not distinguish payment methods."},"unknownPaymentMethodCount":{"type":"integer","minimum":0},"totalAmount":{"type":"integer","minimum":0},"currencies":{"type":"array","maxLength":20,"items":{"type":"string","minLength":3,"maxLength":3}}}},"main":{"type":"procedure","description":"Create a private ATM billing migration review batch from a Ko-fi membership export. Requires service-auth signed by the originating app DID; the actual Stripe/PAN migration remains a guided ATM review step.","input":{"encoding":"application/json","schema":{"type":"object","required":["creatorDid","csvText"],"properties":{"creatorDid":{"type":"string","format":"did"},"csvText":{"type":"string","maxLength":1000000,"description":"Raw Ko-fi membership CSV. ATM stores only masked and hashed review data, never raw emails in the public response."},"environment":{"type":"string","knownValues":["test","live"],"maxLength":8},"importSource":{"type":"string","knownValues":["kofi","substack"],"maxLength":64,"description":"Source platform: Ko-fi (default) or Substack. Selects the CSV parser; the migration engine is source-agnostic."},"dryRun":{"type":"boolean","description":"Preview only: parse the CSV and return summary/tiers/warnings WITHOUT persisting a review batch (batch and dashboardUrl are omitted from the response)."},"requestedCutoverAt":{"type":"string","format":"datetime"},"metadata":{"type":"unknown","description":"App-private migration context such as app-local creator/list ids."}}}},"output":{"encoding":"application/json","schema":{"type":"object","required":["summary","tiers","warnings"],"properties":{"dryRun":{"type":"boolean","description":"True when the request was a dry run: no batch was persisted, so batch and dashboardUrl are omitted."},"batch":{"type":"object","required":["id","status","environment","importSource","migrationPath","creatorDid"],"properties":{"id":{"type":"string","maxLength":128},"status":{"type":"string","maxLength":64},"environment":{"type":"string","knownValues":["test","live"],"maxLength":8},"importSource":{"type":"string","knownValues":["kofi","substack"],"maxLength":64},"migrationPath":{"type":"string","maxLength":128},"creatorDid":{"type":"string","format":"did"},"destinationAccountId":{"type":"string","maxLength":128,"description":"The creator's ATM connected-account id — the PAN-copy destination the app surfaces to the creator. Present once the creator has connected an ATM payout account for this environment."},"appDid":{"type":"string","format":"did"},"requestedCutoverAt":{"type":"string","format":"datetime"}}},"dashboardUrl":{"type":"string","format":"uri"},"summary":{"type":"ref","ref":"#previewSummary"},"tiers":{"type":"array","items":{"type":"ref","ref":"#tierSummary"}},"warnings":{"type":"array","items":{"type":"string","maxGraphemes":300,"maxLength":2000}}}}},"errors":[{"name":"AppEnvironmentNotConfigured","description":"This app environment is not configured in ATM."},{"name":"MigrationBatchRequestFailed","description":"The migration review batch could not be created."}]}}}