// ─── Standard Workflow Templates ─────────────────────────────────────────────
// Seeded on startup if not already present. Attorney can edit via builder.

export const STOCK_WORKFLOWS = [

  // ── Immigration ───────────────────────────────────────────────────────────

  {
    stockId:     'imm_retirement_visa',
    name:        'Retirement Visa (Non-OA) Application',
    description: 'Full process for obtaining a Non-Immigrant OA (retirement) visa and first entry.',
    practiceArea: 'immigration',
    isSystem:    true,
    steps: [
      { stepId: 's01', order: 1,  title: 'Initial consultation & eligibility check',         mandatory: true,  deadlineDays: 2 },
      { stepId: 's02', order: 2,  title: 'Collect client documents (passport, bank, medical)', mandatory: true,  deadlineDays: 7 },
      { stepId: 's03', order: 3,  title: 'Verify 800k THB bank deposit or income proof',       mandatory: true,  deadlineDays: 7 },
      { stepId: 's04', order: 4,  title: 'Obtain police clearance certificate',                mandatory: true,  deadlineDays: 21 },
      { stepId: 's05', order: 5,  title: 'Complete medical certificate (hospital)',             mandatory: true,  deadlineDays: 21 },
      { stepId: 's06', order: 6,  title: 'Prepare visa application package (TM.7)',            mandatory: true,  deadlineDays: 25 },
      { stepId: 's07', order: 7,  title: 'Submit to Royal Thai Embassy / consulate',           mandatory: true,  deadlineDays: 28 },
      { stepId: 's08', order: 8,  title: 'Visa issued — record arrival date',                  mandatory: true },
      { stepId: 's09', order: 9,  title: 'TM.30 filed by landlord (confirm with client)',      mandatory: true,  deadlineDays: 2,  description: 'House master must notify immigration within 24 hours of arrival.' },
      { stepId: 's10', order: 10, title: 'Schedule 90-day report (TM.47)',                     mandatory: true,  description: 'Set recurring reminder — due 90 days from arrival date.' },
    ],
  },

  {
    stockId:     'imm_annual_extension',
    name:        'Annual Visa Extension (TM.7)',
    description: 'Yearly extension of stay for Non-Immigrant visa holders (retirement, B, O, ED).',
    practiceArea: 'immigration',
    isSystem:    true,
    steps: [
      { stepId: 's01', order: 1, title: 'Confirm visa expiry date and extension type',           mandatory: true,  deadlineDays: 45 },
      { stepId: 's02', order: 2, title: 'Verify financial requirements (800k bank / 65k income)', mandatory: true,  deadlineDays: 35 },
      { stepId: 's03', order: 3, title: 'Obtain updated bank letter (dated within 7 days)',       mandatory: true,  deadlineDays: 7 },
      { stepId: 's04', order: 4, title: 'Prepare TM.7 application package',                      mandatory: true,  deadlineDays: 5 },
      { stepId: 's05', order: 5, title: 'Book immigration appointment',                           mandatory: true,  deadlineDays: 3 },
      { stepId: 's06', order: 6, title: 'Attend immigration office — submit TM.7',               mandatory: true,  deadlineDays: 1 },
      { stepId: 's07', order: 7, title: 'Extension stamped — record new expiry date',             mandatory: true },
      { stepId: 's08', order: 8, title: 'Update 90-day report schedule from new stamp',           mandatory: true },
    ],
  },

  {
    stockId:     'imm_work_permit',
    name:        'Work Permit Application (WP.1 / WP.10)',
    description: 'New work permit application for Non-B visa holder with employer sponsorship.',
    practiceArea: 'immigration',
    isSystem:    true,
    steps: [
      { stepId: 's01', order: 1,  title: 'Confirm Non-B visa and employer engagement',              mandatory: true },
      { stepId: 's02', order: 2,  title: 'Collect employer company documents (DBD, VAT, BOJ.5)',    mandatory: true,  deadlineDays: 7 },
      { stepId: 's03', order: 3,  title: 'Collect employee documents (passport, photos, degree)',    mandatory: true,  deadlineDays: 7 },
      { stepId: 's04', order: 4,  title: 'Verify 4:1 Thai employee ratio (DOE requirement)',        mandatory: true },
      { stepId: 's05', order: 5,  title: 'Prepare WP.1 application (or WP.10 renewal)',             mandatory: true,  deadlineDays: 10 },
      { stepId: 's06', order: 6,  title: 'Submit at Department of Employment',                      mandatory: true },
      { stepId: 's07', order: 7,  title: 'Work permit issued — record expiry date',                 mandatory: true },
      { stepId: 's08', order: 8,  title: 'Ensure Non-B visa aligned with permit expiry',            mandatory: true },
      { stepId: 's09', order: 9,  title: 'Schedule renewal reminder (30 days before expiry)',       mandatory: true },
    ],
  },

  {
    stockId:     'imm_tm47_90day',
    name:        '90-Day Reporting (TM.47)',
    description: 'Recurring 90-day report to immigration. Process for each reporting cycle.',
    practiceArea: 'immigration',
    isSystem:    true,
    steps: [
      { stepId: 's01', order: 1, title: 'Confirm reporting window (15 days before or 7 days after due date)', mandatory: true },
      { stepId: 's02', order: 2, title: 'Attempt online report at immigration.go.th',                          mandatory: false, description: 'Online reporting available for most visa types. Saves a trip.' },
      { stepId: 's03', order: 3, title: 'If online fails — attend immigration office with TM.47',             mandatory: false },
      { stepId: 's04', order: 4, title: 'Report stamped — record date and set next due date (+90 days)',       mandatory: true },
    ],
  },

  // ── Corporate ─────────────────────────────────────────────────────────────

  {
    stockId:     'corp_company_registration',
    name:        'Thai Company Registration (DBD)',
    description: 'Full process for registering a Thai limited company with the Department of Business Development.',
    practiceArea: 'corporate',
    isSystem:    true,
    steps: [
      { stepId: 's01', order: 1,  title: 'Name reservation (DBD)',                                    mandatory: true,  deadlineDays: 3 },
      { stepId: 's02', order: 2,  title: 'Draft memorandum of association',                            mandatory: true,  deadlineDays: 7 },
      { stepId: 's03', order: 3,  title: 'Statutory meeting of promoters',                             mandatory: true,  deadlineDays: 14 },
      { stepId: 's04', order: 4,  title: 'Collect shareholder / director documents',                   mandatory: true,  deadlineDays: 10 },
      { stepId: 's05', order: 5,  title: 'Open corporate bank account',                                mandatory: true,  deadlineDays: 14 },
      { stepId: 's06', order: 6,  title: 'Capital deposit (25% paid-up minimum)',                      mandatory: true,  deadlineDays: 14 },
      { stepId: 's07', order: 7,  title: 'Submit registration application to DBD',                     mandatory: true,  deadlineDays: 21 },
      { stepId: 's08', order: 8,  title: 'Company registered — receive certificate',                   mandatory: true },
      { stepId: 's09', order: 9,  title: 'Register for VAT (Revenue Dept) — if turnover > 1.8M/yr',   mandatory: false, deadlineDays: 30 },
      { stepId: 's10', order: 10, title: 'Register employer with Social Security Office',              mandatory: true,  deadlineDays: 30 },
      { stepId: 's11', order: 11, title: 'Schedule annual AGM reminder (within 4 months of year-end)', mandatory: true },
    ],
  },

  {
    stockId:     'corp_annual_maintenance',
    name:        'Annual Corporate Maintenance',
    description: 'Yearly compliance cycle for Thai limited companies: AGM, financial statements, DBD filing.',
    practiceArea: 'corporate',
    isSystem:    true,
    steps: [
      { stepId: 's01', order: 1, title: 'Engage auditor (CPA) — collect financial records',            mandatory: true,  deadlineDays: 60 },
      { stepId: 's02', order: 2, title: 'Audited financial statements completed',                      mandatory: true,  deadlineDays: 90 },
      { stepId: 's03', order: 3, title: 'Hold AGM — approve statements and director report',           mandatory: true,  deadlineDays: 120, description: 'Must be held within 4 months of financial year-end (April 30 for Dec 31 year-end).' },
      { stepId: 's04', order: 4, title: 'File BOJ.5 with DBD (within 1 month of AGM)',                mandatory: true,  deadlineDays: 150 },
      { stepId: 's05', order: 5, title: 'File corporate income tax return (PND.50)',                   mandatory: true,  deadlineDays: 150, description: 'Due within 150 days of year-end.' },
      { stepId: 's06', order: 6, title: 'Confirm shareholder register is up to date',                 mandatory: true },
    ],
  },

  // ── Property ──────────────────────────────────────────────────────────────

  {
    stockId:     'prop_purchase',
    name:        'Property Purchase (Condo / Land)',
    description: 'End-to-end process for a foreigner purchasing Thai property (condo title or land via company).',
    practiceArea: 'property',
    isSystem:    true,
    steps: [
      { stepId: 's01', order: 1,  title: 'Due diligence — title search at Land Department',             mandatory: true },
      { stepId: 's02', order: 2,  title: 'Verify foreign quota (condo: max 49% foreign ownership)',    mandatory: true },
      { stepId: 's03', order: 3,  title: 'Confirm FET (Foreign Exchange Transaction) certificate',      mandatory: true,  description: 'Required to prove funds transferred from abroad in foreign currency.' },
      { stepId: 's04', order: 4,  title: 'Review sale/purchase agreement',                             mandatory: true },
      { stepId: 's05', order: 5,  title: 'Negotiate terms and conditions',                             mandatory: false },
      { stepId: 's06', order: 6,  title: 'Execute sale/purchase agreement and pay deposit',            mandatory: true },
      { stepId: 's07', order: 7,  title: 'Prepare transfer documents for Land Department',             mandatory: true },
      { stepId: 's08', order: 8,  title: 'Transfer at Land Department — pay transfer fee and taxes',   mandatory: true },
      { stepId: 's09', order: 9,  title: 'Chanote (title deed) issued in client name',                mandatory: true },
      { stepId: 's10', order: 10, title: 'Register juristic person membership (condo)',                mandatory: false },
    ],
  },

  {
    stockId:     'prop_lease',
    name:        'Long-Term Lease Agreement (30-year)',
    description: 'Drafting and registration of a 30-year lease at the Land Department.',
    practiceArea: 'property',
    isSystem:    true,
    steps: [
      { stepId: 's01', order: 1, title: 'Confirm land title is leasable (not restricted)',              mandatory: true },
      { stepId: 's02', order: 2, title: 'Negotiate lease terms (rent, renewal options, improvements)',  mandatory: true },
      { stepId: 's03', order: 3, title: 'Draft lease agreement',                                       mandatory: true },
      { stepId: 's04', order: 4, title: 'Client reviews and approves draft',                           mandatory: true },
      { stepId: 's05', order: 5, title: 'Execute lease agreement',                                     mandatory: true },
      { stepId: 's06', order: 6, title: 'Register lease at Land Department (mandatory for >3 years)',   mandatory: true, description: 'Pay stamp duty and registration fee. Lease is enforceable against third parties only when registered.' },
      { stepId: 's07', order: 7, title: 'Registered lease returned — record expiry date',              mandatory: true },
      { stepId: 's08', order: 8, title: 'Schedule renewal reminder (6 months before expiry)',          mandatory: true },
    ],
  },

  // ── Civil Litigation ──────────────────────────────────────────────────────

  {
    stockId:     'lit_civil_claim',
    name:        'Civil Litigation — Filing a Claim',
    description: 'Standard process for filing a civil claim in Thai court.',
    practiceArea: 'civil_litigation',
    isSystem:    true,
    steps: [
      { stepId: 's01', order: 1,  title: 'Assess claim — cause of action, limitation period',           mandatory: true },
      { stepId: 's02', order: 2,  title: 'Attempt pre-litigation settlement / demand letter',           mandatory: false },
      { stepId: 's03', order: 3,  title: 'Collect evidence and witness statements',                    mandatory: true },
      { stepId: 's04', order: 4,  title: 'Prepare statement of claim (คำฟ้อง)',                        mandatory: true },
      { stepId: 's05', order: 5,  title: 'Calculate court fees and prepare payment',                   mandatory: true },
      { stepId: 's06', order: 6,  title: 'File claim at court — obtain case number',                   mandatory: true },
      { stepId: 's07', order: 7,  title: 'Service of process on defendant',                            mandatory: true },
      { stepId: 's08', order: 8,  title: 'First hearing — confirm attendance',                        mandatory: true },
      { stepId: 's09', order: 9,  title: 'Witness examination / trial hearings',                      mandatory: true },
      { stepId: 's10', order: 10, title: 'Judgment received — advise client',                         mandatory: true },
      { stepId: 's11', order: 11, title: 'Enforce judgment if required',                              mandatory: false },
    ],
  },

  // ── Family ────────────────────────────────────────────────────────────────

  {
    stockId:     'fam_divorce',
    name:        'Divorce — Uncontested (Administrative)',
    description: 'Administrative divorce registration at district office for mutually agreed separations.',
    practiceArea: 'family',
    isSystem:    true,
    steps: [
      { stepId: 's01', order: 1, title: 'Confirm both parties agree to divorce terms',               mandatory: true },
      { stepId: 's02', order: 2, title: 'Draft divorce agreement (asset division, custody if any)', mandatory: true },
      { stepId: 's03', order: 3, title: 'Both parties sign agreement before witnesses',             mandatory: true },
      { stepId: 's04', order: 4, title: 'Attend district office (Amphur) — both parties present',  mandatory: true },
      { stepId: 's05', order: 5, title: 'Divorce registered — collect divorce certificate',        mandatory: true },
      { stepId: 's06', order: 6, title: 'Update passports / ID if name change involved',           mandatory: false },
    ],
  },
]
