#!/usr/bin/env python3
"""Compose a ready-to-post banner: brand frame + any image in the well.

Usage:
  compose_article_banner.py <well_image.png> <output_name.png> [size]
    size: landscape (1200x630) | square (1080x1080) | portrait (1080x1350)
"""
import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from build_banner_concept import build, OUT

SIZES = {
    "landscape": ((1200, 630), (40, 40, 1160, 380), 440, 140, 430),
    "square":    ((1080, 1080), (40, 40, 1040, 780), 840, 150, 400),
    "portrait":  ((1080, 1350), (40, 40, 1040, 1010), 1080, 160, 420),
}

def main():
    if len(sys.argv) < 3:
        print(__doc__); sys.exit(2)
    well_image, name = sys.argv[1], sys.argv[2]
    size = sys.argv[3] if len(sys.argv) > 3 else "landscape"
    (sz, well_bbox, band_top, badge_size, logo_w) = SIZES[size]
    out = OUT                                    # canonical output inside this bundle
    os.makedirs(out, exist_ok=True)
    build(sz, well_bbox, band_top, badge_size, logo_w,
          os.path.join(out, name), well_image=well_image)

if __name__ == "__main__":
    main()
