{
  "WIA_CODE_TECHNICAL_SPECIFICATION": {
    "version": "1.0",
    "title": "WIA Pin Code Original Technical Specification",
    "created": "2024-08-20",
    "copyright": "Open Source - No Patent (Like Coca-Cola Recipe)",
    "philosophy": "주소는 인권이다. 21억 명에게 무료로 제공한다.",
    
    "CORE_PRINCIPLES": {
      "encoding_formula": {
        "description": "GPS 좌표를 9자리 숫자로 변환",
        "latitude": {
          "range": "-90 to +90",
          "formula": "((lat + 90) / 180) * 999999",
          "digits": 6,
          "example": "708698"
        },
        "longitude": {
          "range": "-180 to +180",
          "formula": "((lng + 180) / 360) * 999",
          "digits": 3,
          "example": "526"
        },
        "final_code": {
          "format": "XXX-XXX-XXX",
          "formula": "latPart(6) + lngPart(3)",
          "example": "708-698-526",
          "precision": "11cm at equator"
        }
      },
      
      "hierarchy_principle": {
        "name": "같은 은하, 같은 행성은 생략 가능",
        "levels": {
          "full": "1-003-708-698-526",
          "international": "82-708-698-526",
          "local": "708-698-526",
          "extended": "708-698-526.15.A.1502"
        },
        "context_rules": {
          "same_country": "국가코드 생략",
          "same_planet": "1-003 생략",
          "same_building": "기본코드 생략"
        }
      }
    },
    
    "MATHEMATICAL_OPERATORS": {
      "description": "수학 기호를 사용한 무한 확장 체계",
      "operators": {
        ".": {
          "meaning": "하위 구분/계층",
          "usage": "기본 구분자",
          "example": "708-698-526.15.A.1502",
          "description": "층.구역.호수 등 하위 요소 구분"
        },
        "+": {
          "meaning": "위/상부/추가",
          "usage": "상향 표현",
          "examples": {
            "rooftop": "708-698-526+1",
            "helipad": "708-698-526+2",
            "altitude": "708-698-526+500",
            "duplex": "708-698-526.15+0.5"
          }
        },
        "-": {
          "meaning": "아래/하부/지하",
          "usage": "하향 표현",
          "examples": {
            "basement": "708-698-526-1",
            "semi_basement": "708-698-526-0.5",
            "underground": "708-698-526-100",
            "ocean_depth": "708-698-526-3000"
          }
        },
        "*": {
          "meaning": "반복/다중/그룹",
          "usage": "복수 구역 표현",
          "examples": {
            "multiple_zones": "708-698-526*3",
            "all_floors": "708-698-526.15*5",
            "building_complex": "708-698-526*102.15",
            "parking_sections": "708-698-526-2*B"
          }
        },
        "/": {
          "meaning": "분할/비율/공유",
          "usage": "부분 표현",
          "examples": {
            "half_space": "708-698-526/2",
            "quarter_floor": "708-698-526.15/4",
            "time_share": "708-698-526/AM",
            "seat_number": "708-698-526.2*A/15"
          }
        }
      },
      
      "complex_expressions": {
        "description": "복합 수식 사용 예시",
        "examples": {
          "underground_parking": "708-698-526-2*B.15",
          "rooftop_half": "708-698-526+1/2",
          "multiple_floors": "708-698-526.15*3+0.5",
          "stadium_seat": "708-698-526.3*S/A.15.7",
          "time_based": "708-698-526.5*24/9"
        }
      }
    },
    
    "FLOOR_LEVEL_SYSTEM": {
      "description": "모든 고도를 숫자로 표현",
      "underground": {
        "format": "negative numbers",
        "examples": {
          "B3": "-3",
          "B2": "-2",
          "B1": "-1",
          "semi_basement": "-0.5",
          "deep_cave": "-500",
          "ocean_floor": "-10994"
        }
      },
      "ground": {
        "lobby": "0",
        "ground_floor": "0",
        "piloti": "0.P"
      },
      "above_ground": {
        "format": "positive numbers",
        "regular_floors": "1, 2, 3, ..., 99, 100",
        "mezzanine": "1.5",
        "duplex": "15+0.5"
      },
      "special": {
        "rooftop": "+1",
        "helipad": "+2",
        "altitude": "+XXXX",
        "space": "+408000"
      }
    },
    
    "PHONE_NUMBER_INTEGRATION": {
      "concept": "전화번호 = 주소 (매핑 방식)",
      "principle": "전화번호를 WIA로 변환하는 것이 아니라, 전화번호에 WIA를 매핑",
      "no_collision": {
        "reason": "WIA는 위치 고정값, 전화번호는 단순 키",
        "example": {
          "multiple_phones_one_location": {
            "010-1111-1111": "796-603-482",
            "010-2222-2222": "796-603-482",
            "comment": "같은 아파트 주민들 - 정상"
          },
          "one_phone_multiple_locations": {
            "010-1234-5678": ["796-603-482", "708-698-526"],
            "comment": "집과 회사 - 정상"
          }
        }
      },
      "database_structure": {
        "table": "phone_wia_mapping",
        "key_fields": {
          "country_code": "VARCHAR(5)",
          "phone_number": "VARCHAR(30)",
          "wia_home": "VARCHAR(11)",
          "wia_office": "VARCHAR(11)",
          "wia_default": "VARCHAR(11)"
        }
      },
      "privacy_protection": {
        "concept": "배달업체는 전화번호 모름",
        "flow": "고객 전화번호 → WIA 시스템 → WIA Pin Code만 전달 → 배달업체"
      },
      "global_support": {
        "all_countries": "모든 국가 전화번호 체계 그대로 지원",
        "examples": {
          "korea": "010-1234-5678",
          "usa": "(212) 555-0123",
          "nigeria": "0803-123-4567",
          "india": "+91-98765-43210"
        }
      },
      "smart_switching": {
        "time_based": {
          "09:00-18:00": "office",
          "18:00-09:00": "home"
        },
        "context_based": {
          "delivery": "ask_user",
          "emergency": "current_gps"
        }
      }
    },
    
    "STANDARD_PATTERNS": {
      "residential": {
        "apartment": {
          "format": "base*building.floor.unit",
          "example": "708-698-526*102.15.1502",
          "description": "102동 15층 1502호"
        },
        "house": {
          "format": "base.floor",
          "example": "708-698-526.0",
          "with_room": "708-698-526.2.A"
        }
      },
      "commercial": {
        "office": {
          "format": "base.floor.zone.room",
          "example": "708-698-526.45.N.4501"
        },
        "mall": {
          "format": "base.floor.shop",
          "example": "708-698-526.3.F12",
          "parking": "708-698-526-2*P.A15"
        }
      },
      "transportation": {
        "airport": {
          "terminal": "708-698-526*T2",
          "gate": "708-698-526*T2+G15",
          "immigration": "708-698-526*T2.IMM"
        },
        "subway": {
          "platform": "708-698-526-2.P.3",
          "exit": "708-698-526.0.E.7",
          "line_transfer": "708-698-526-1.T.2-5"
        }
      },
      "medical": {
        "hospital": {
          "emergency": "708-698-526.1.ER",
          "appointment": "708-698-526.3.301.1430.Dr.Kim",
          "ward": "708-698-526.7.W.705"
        }
      }
    },
    
    "PARSING_RULES": {
      "regex_patterns": {
        "base": "^\\d{3}-\\d{3}-\\d{3}",
        "operators": "[+\\-*/]",
        "numbers": "\\d+(\\.\\d+)?",
        "full_pattern": "^\\d{3}-\\d{3}-\\d{3}([+\\-*/\\.].+)?$"
      },
      "parsing_logic": {
        "step1": "Extract base code (9 digits)",
        "step2": "Identify operators",
        "step3": "Parse values",
        "step4": "Apply operations",
        "step5": "Return structured object"
      },
      "example_function": "function parseWIA(code) {\n  const base = code.match(/\\d{3}-\\d{3}-\\d{3}/)[0];\n  const extensions = code.replace(base, '');\n  // Parse extensions with math operators\n  return { base, extensions };\n}"
    },
    
    "IMPLEMENTATION": {
      "database_schema": {
        "wia_base": {
          "type": "VARCHAR(11)",
          "format": "XXX-XXX-XXX",
          "index": "PRIMARY"
        },
        "wia_extended": {
          "type": "VARCHAR(100)",
          "format": "base.operator.value",
          "nullable": true
        },
        "floor_code": {
          "type": "VARCHAR(10)",
          "format": "numeric with +/-",
          "default": "0"
        },
        "zone_code": {
          "type": "VARCHAR(10)",
          "nullable": true
        },
        "unit_code": {
          "type": "VARCHAR(20)",
          "nullable": true
        },
        "phone_number": {
          "type": "VARCHAR(20)",
          "index": "UNIQUE",
          "nullable": true
        }
      },
      
      "api_endpoints": {
        "generate": {
          "input": {"lat": "number", "lng": "number"},
          "output": {"wia": "string"}
        },
        "parse": {
          "input": {"wia": "string"},
          "output": {"base": "string", "components": "object"}
        },
        "phone_link": {
          "input": {"phone": "string", "wia": "string"},
          "output": {"success": "boolean"}
        },
        "extend": {
          "input": {"base": "string", "extensions": "array"},
          "output": {"extended_wia": "string"}
        }
      },
      
      "sdk_functions": {
        "javascript": {
          "generateWIA": "(lat, lng) => string",
          "parseWIA": "(wiaCode) => object",
          "validateWIA": "(wiaCode) => boolean",
          "extendWIA": "(base, ...parts) => string",
          "linkPhone": "(phone, wia) => Promise<boolean>"
        }
      }
    },
    
    "REVENUE_MODEL": {
      "free_forever": {
        "developing_nations": "50 countries",
        "citizens": "2.1 billion people",
        "emergency_services": "Global",
        "personal_use": "Basic features"
      },
      "paid_services": {
        "enterprise_api": "$999/month per 1M calls",
        "logistics": "Volume based pricing",
        "premium_numbers": {
          "bronze": "$9/year",
          "silver": "$99/year",
          "gold": "$999/year",
          "platinum": "$9999/year"
        },
        "data_analytics": "Custom pricing"
      }
    },
    
    "FUTURE_EXTENSIONS": {
      "reserved_operators": {
        "^": "3D coordinates/dimensions",
        "@": "Time component",
        "#": "Parallel/alternative",
        "~": "Approximate/nearby",
        "&": "Combined/linked",
        "!": "Emergency/priority"
      },
      "space_expansion": {
        "mars": "1-004-XXX-XXX-XXX",
        "moon": "1-003-001-XXX-XXX-XXX",
        "iss": "1-003-900-XXX-XXX-XXX"
      }
    },
    
    "ADOPTION_STRATEGY": {
      "phase1": "Africa 50 nations free deployment",
      "phase2": "Low-engagement apps natural exposure",
      "phase3": "First nation official adoption",
      "phase4": "Domino effect neighboring countries",
      "phase5": "Global standardization"
    },
    
    "LICENSE": {
      "type": "Trade Secret",
      "model": "Coca-Cola Strategy",
      "reason": "주소는 인류의 기본권이므로 특허로 독점하지 않는다",
      "api": "Open API with rate limits",
      "sdk": "Open Source SDKs"
    },
    
    "VALIDATION": {
      "base_code": {
        "min_length": 11,
        "max_length": 200,
        "format": "XXX-XXX-XXX[extensions]"
      },
      "precision": {
        "equator": "11.1cm",
        "poles": "3.5cm",
        "average": "7.8cm"
      },
      "coverage": {
        "earth": "100%",
        "ocean": "100%",
        "underground": "Unlimited depth",
        "altitude": "Unlimited height"
      }
    }
  }
}