<?php

return <<<'SQL'
CREATE TABLE scan_templates (
    id CHAR(36) NOT NULL PRIMARY KEY,
    tenant_id CHAR(36) NOT NULL,
    name VARCHAR(180) NOT NULL,
    page_width INT NOT NULL,
    page_height INT NOT NULL,
    anchor_json LONGTEXT NULL,
    grid_json LONGTEXT NOT NULL,
    is_active TINYINT(1) NOT NULL DEFAULT 1,
    created_at DATETIME NOT NULL,
    updated_at DATETIME NOT NULL,
    UNIQUE (tenant_id, name),
    FOREIGN KEY (tenant_id) REFERENCES tenants(id)
);
SQL;
