"""Generate DOCX versions of Intesar's analysis comparison reports."""

from docx import Document
from docx.shared import Pt, Inches, RGBColor, Cm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
import os

OUTPUT_DIR = r"C:\Users\sallen\Desktop\SHEP\BAR PREP by SHEP\STUDENT ANSWERS\Intesar"

NAVY = RGBColor(0x1a, 0x27, 0x44)
GOLD = RGBColor(0xc9, 0xa2, 0x27)
MED_TEXT = RGBColor(0x2d, 0x37, 0x48)
LIGHT_TEXT = RGBColor(0x4a, 0x55, 0x68)
WHITE = RGBColor(0xff, 0xff, 0xff)


def set_cell_shading(cell, hex_color):
    shading = OxmlElement("w:shd")
    shading.set(qn("w:fill"), hex_color)
    shading.set(qn("w:val"), "clear")
    cell._tc.get_or_add_tcPr().append(shading)


def set_cell_borders(cell, color="D4CFC5", width="4"):
    tc_pr = cell._tc.get_or_add_tcPr()
    borders = OxmlElement("w:tcBorders")
    for edge in ("top", "left", "bottom", "right"):
        el = OxmlElement(f"w:{edge}")
        el.set(qn("w:val"), "single")
        el.set(qn("w:sz"), width)
        el.set(qn("w:color"), color)
        el.set(qn("w:space"), "0")
        borders.append(el)
    tc_pr.append(borders)


def add_shaded_block(doc, text, bg_hex):
    table = doc.add_table(rows=1, cols=1)
    table.columns[0].width = Inches(6.2)
    cell = table.cell(0, 0)
    cell.text = ""
    p = cell.paragraphs[0]
    run = p.add_run(text)
    run.font.size = Pt(9)
    run.font.color.rgb = MED_TEXT
    p.paragraph_format.space_after = Pt(0)
    p.paragraph_format.space_before = Pt(0)
    set_cell_shading(cell, bg_hex)
    set_cell_borders(cell)
    doc.add_paragraph()


def add_rewrite_pair(doc, before, after):
    table = doc.add_table(rows=2, cols=1)
    table.columns[0].width = Inches(6.2)

    # Before
    c1 = table.cell(0, 0)
    c1.text = ""
    p1 = c1.paragraphs[0]
    label1 = p1.add_run("CONCLUSORY:  ")
    label1.bold = True
    label1.font.size = Pt(7.5)
    label1.font.color.rgb = LIGHT_TEXT
    body1 = p1.add_run(before)
    body1.font.size = Pt(9)
    body1.font.color.rgb = MED_TEXT
    p1.paragraph_format.space_after = Pt(0)
    set_cell_shading(c1, "FCE8E8")
    set_cell_borders(c1)

    # After
    c2 = table.cell(1, 0)
    c2.text = ""
    p2 = c2.paragraphs[0]
    label2 = p2.add_run("REWRITTEN:  ")
    label2.bold = True
    label2.font.size = Pt(7.5)
    label2.font.color.rgb = LIGHT_TEXT
    body2 = p2.add_run(after)
    body2.font.size = Pt(9)
    body2.font.color.rgb = MED_TEXT
    p2.paragraph_format.space_after = Pt(0)
    set_cell_shading(c2, "E2F0E2")
    set_cell_borders(c2)

    doc.add_paragraph()


def add_action_box(doc, text):
    table = doc.add_table(rows=1, cols=1)
    table.columns[0].width = Inches(6.2)
    cell = table.cell(0, 0)
    cell.text = ""
    p = cell.paragraphs[0]
    run = p.add_run(text)
    run.font.size = Pt(9)
    run.font.color.rgb = RGBColor(0x1e, 0x3a, 0x5f)
    p.paragraph_format.space_after = Pt(0)
    set_cell_shading(cell, "F0F4FF")
    doc.add_paragraph()


def setup_doc():
    doc = Document()
    style = doc.styles["Normal"]
    style.font.name = "Calibri"
    style.font.size = Pt(10)
    style.font.color.rgb = MED_TEXT
    style.paragraph_format.space_after = Pt(4)
    style.paragraph_format.space_before = Pt(0)

    for section in doc.sections:
        section.top_margin = Cm(1.8)
        section.bottom_margin = Cm(1.5)
        section.left_margin = Cm(2.2)
        section.right_margin = Cm(2.2)

    return doc


def add_title(doc, text):
    p = doc.add_paragraph()
    run = p.add_run(text)
    run.bold = True
    run.font.size = Pt(16)
    run.font.color.rgb = NAVY
    p.paragraph_format.space_after = Pt(2)


def add_subtitle(doc, text):
    p = doc.add_paragraph()
    run = p.add_run(text)
    run.font.size = Pt(9)
    run.font.color.rgb = LIGHT_TEXT
    p.paragraph_format.space_after = Pt(10)


def add_gold_line(doc):
    p = doc.add_paragraph()
    p.paragraph_format.space_after = Pt(4)
    run = p.add_run("_" * 20)
    run.font.color.rgb = GOLD
    run.font.size = Pt(6)


def add_h1(doc, text):
    p = doc.add_paragraph()
    run = p.add_run(text)
    run.bold = True
    run.font.size = Pt(12)
    run.font.color.rgb = NAVY
    p.paragraph_format.space_before = Pt(12)
    p.paragraph_format.space_after = Pt(4)


def add_h2(doc, text):
    p = doc.add_paragraph()
    run = p.add_run(text)
    run.bold = True
    run.font.size = Pt(10)
    run.font.color.rgb = MED_TEXT
    p.paragraph_format.space_before = Pt(6)
    p.paragraph_format.space_after = Pt(2)


def add_body(doc, text, bold_start=None):
    p = doc.add_paragraph()
    if bold_start:
        b = p.add_run(bold_start)
        b.bold = True
        b.font.size = Pt(9.5)
        b.font.color.rgb = MED_TEXT
        r = p.add_run(text)
    else:
        r = p.add_run(text)
    r.font.size = Pt(9.5)
    r.font.color.rgb = MED_TEXT
    p.paragraph_format.space_after = Pt(4)


def add_footer(doc, text):
    p = doc.add_paragraph()
    run = p.add_run(text)
    run.font.size = Pt(7.5)
    run.font.color.rgb = LIGHT_TEXT
    p.paragraph_format.space_before = Pt(16)


# =====================================================================
# BUSINESS ASSOCIATIONS
# =====================================================================
def build_business_associations():
    doc = setup_doc()
    add_title(doc, "Deepening Your Analysis: Business Associations")
    add_gold_line(doc)
    add_subtitle(doc, "Intesar S.  |  Band 4/6  |  May 19, 2026")

    add_body(doc,
        "On the bar exam, analysis is where you earn the most points. The rule statement "
        "shows you know the law. The analysis shows you can use it. Analysis means taking "
        "the specific facts from the prompt and explaining, step by step, why they satisfy or fail "
        "each element of the rule. A conclusion without this reasoning is just an assertion -- the "
        "grader has no evidence you understood the problem. Below, we compare the analysis portions "
        "of your essay against a model answer, with specific ways to strengthen each one.")

    # Issue 1
    add_h1(doc, "Issue 1: Carol's Authority to Bind the Partnership")
    add_h2(doc, "Your analysis:")
    add_shaded_block(doc,
        "Carol was hired as a sales manager, and the partnership explicitly told her she could "
        "approve custom orders only up to $5,000. However, last month, the partnership allowed "
        "a $5,500 contract to proceed without comment. Carol's $7,000 contract fails under actual "
        "authority because Carol does not have actual authority to exceed the $5,000 limit, despite "
        "the previous $5,500 contract. Therefore, the contract does not bind the partnership.",
        "FDF6EE")
    add_h2(doc, "Model analysis:")
    add_shaded_block(doc,
        "Carol lacked actual authority. A&B explicitly told her she could only approve orders "
        "up to $5,000. However, Carol likely had apparent authority. A&B's prior conduct -- "
        "allowing the $5,500 contract to proceed without comment -- was a manifestation to the "
        "public. A new client like Dave could reasonably believe, based on A&B's past "
        "acquiescence to an over-the-limit contract, that Carol had the authority to enter into "
        "similar contracts. The principal's manifestation, not the agent's, creates apparent "
        "authority. Therefore, A&B Designs is bound.",
        "EEF5EE")
    add_body(doc,
        "You correctly applied the $5,000 limit to show actual authority fails. But you stopped "
        "there. The $5,500 contract is the most important fact in this question -- it exists to "
        "trigger a second theory: apparent authority. You mentioned it but dismissed it. The model "
        "uses it as the crux: the partnership's silence told outsiders like Dave that Carol could "
        "approve larger deals. When one theory fails, the exam is almost always testing whether "
        "you will spot the next one.")
    add_action_box(doc,
        "Build this habit: Every time you write \"therefore, this fails,\" pause and ask: "
        "do the facts support an alternative theory that succeeds? Write two sentences on it, "
        "even if brief. That is where the points are.")

    # Issue 2
    add_h1(doc, "Issue 2: Partnership Liability for the Showroom Lease")
    add_h2(doc, "Your analysis:")
    add_shaded_block(doc,
        "Ben, despite not consulting Alice, signed a one-year lease for a large new showroom "
        "with Landlord Corp. The lease will likely bind the partnership because Ben was acting "
        "within the ordinary course of business dealings and did not exceed his actual authority.",
        "FDF6EE")
    add_h2(doc, "Model analysis:")
    add_shaded_block(doc,
        "Ben, a partner, signed a lease for a showroom. For a business that creates and sells "
        "custom furniture, having a showroom is squarely within the ordinary course of business. "
        "It is not an extraordinary matter requiring a unanimous vote of the partners. Because "
        "the act was in the ordinary course, Ben had the authority to bind the partnership.",
        "EEF5EE")
    add_body(doc,
        "You reached the right answer. The gap is one missing sentence: why is a showroom "
        "lease \"ordinary course\"? You asserted it. The model explains it -- a furniture design "
        "firm needs a showroom to display products, so leasing one is routine. That single "
        "explanatory sentence turns an assertion into analysis.")
    add_action_box(doc,
        "Build this habit: After every conclusion, add one sentence starting with "
        "\"because\" that ties it to the specific facts. \"This is ordinary course because "
        "a furniture firm needs a showroom\" -- that is the analysis.")

    # Issue 3
    add_h1(doc, "Issue 3: Ben's Duty of Loyalty (Van Sale)")
    add_h2(doc, "Your analysis:")
    add_shaded_block(doc,
        "Ben proposed that the corporation buy the van for $30,000, providing the material facts "
        "by disclosing his ownership of the dealership and presenting reliable data showing the "
        "price is fair market value, and the majority of disinterested directors voted in favor "
        "when Alice reviewed the data and voted to approve the purchase.",
        "FDF6EE")
    add_h2(doc, "Model analysis:")
    add_shaded_block(doc,
        "The van sale was a classic conflicting interest transaction because Ben stood on both "
        "sides: as a director of the buyer and as the sole owner of the seller. However, Ben "
        "followed the disinterested director safe harbor. He disclosed the material facts and "
        "his interest to the board. Alice was disinterested as she had no financial stake in "
        "Ben's dealership. After reviewing data, Alice voted to approve. This cleansed the "
        "transaction.",
        "EEF5EE")
    add_body(doc,
        "This is your strongest section -- you identified the right elements, applied each to "
        "the facts, and reached the correct conclusion. The one difference: the model names the "
        "problem before solving it. \"Ben stood on both sides\" tells the reader why the "
        "duty of loyalty is triggered. You jumped straight into the safe harbor without explaining "
        "what made this transaction suspicious. Setting up the conflict first makes your resolution "
        "more persuasive.")
    add_action_box(doc,
        "Build this habit: Before applying a legal test, write one sentence identifying "
        "what makes this situation problematic. \"This is a conflict because Ben is on "
        "both sides of the deal\" -- then the safe harbor analysis lands with more force.")

    # Conclusory vs Proper
    add_h1(doc, "Conclusory Analysis vs. Proper Analysis")
    add_body(doc,
        "Below are specific sentences from your essay rewritten to show the difference. The "
        "conclusory version states the outcome. The rewritten version explains why the "
        "facts lead there.")

    add_h2(doc, "Issue 1 -- The $5,500 contract")
    add_rewrite_pair(doc,
        "Carol's $7,000 contract fails under actual authority because Carol does not have "
        "actual authority to exceed the $5,000 limit, despite the previous $5,500 contract "
        "that was allowed.",
        "Carol lacked actual authority because the partnership capped her at $5,000. However, "
        "by letting the $5,500 contract proceed without objection, the partnership signaled to "
        "outsiders that Carol could approve larger deals. Dave, a new client, could reasonably "
        "believe Carol had authority -- and that appearance binds the partnership.")

    add_h2(doc, "Issue 2 -- Ordinary course of business")
    add_rewrite_pair(doc,
        "The lease will likely bind the partnership because Ben was acting within the ordinary "
        "course of business dealings and did not exceed his actual authority.",
        "The lease binds the partnership because a custom furniture business needs a showroom "
        "to display its products -- leasing one is a routine business need, not an extraordinary "
        "decision requiring both partners' consent.")

    add_h2(doc, "Issue 2 -- Alice's personal liability")
    add_rewrite_pair(doc,
        "Alice is personally liable on the showroom lease because the general partnership "
        "creates a joint and several liability to the partnership.",
        "Alice is jointly and severally liable because she is a general partner -- Landlord "
        "Corp. could pursue her personally for the full lease amount, even though she never "
        "agreed to it.")

    add_h2(doc, "Issue 3 -- Self-dealing setup")
    add_rewrite_pair(doc,
        "Ben proposed that the corporation buy the van for $30,000, providing the material "
        "facts by disclosing his ownership of the dealership.",
        "This is a self-dealing transaction because Ben stands on both sides -- director of "
        "the buyer and owner of the seller. However, he disclosed his interest and ownership "
        "to the board before the vote.")

    # Closing
    add_body(doc,
        "You already know the law. Your issue spotting is complete and your conclusions are almost "
        "always correct. The gap between a 4 and a 6 is showing more of your reasoning on the "
        "page: (1) when one theory fails, look for a second one; (2) after every conclusion, "
        "add a \"because\" sentence tied to the specific facts; (3) name the problem before you "
        "solve it. These are small changes that compound.")
    add_footer(doc, "Bar Prep by SHEP  |  May 19, 2026")

    path = os.path.join(OUTPUT_DIR, "Intesar_Business-Associations_Analysis.docx")
    doc.save(path)
    return path


# =====================================================================
# REAL PROPERTY
# =====================================================================
def build_real_property():
    doc = setup_doc()
    add_title(doc, "Deepening Your Analysis: Real Property")
    add_gold_line(doc)
    add_subtitle(doc, "Intesar S.  |  Band 3/6  |  May 14, 2026")

    add_body(doc,
        "On the bar exam, analysis is where you earn the most points. The rule statement "
        "shows you know the law. The analysis shows you can use it. Analysis means taking "
        "the specific facts from the prompt and explaining, step by step, why they satisfy or fail "
        "each element of the rule. A conclusion without this reasoning is just an assertion -- the "
        "grader has no evidence you understood the problem. Below, we compare the analysis portions "
        "of your essay against a model answer, with specific ways to strengthen each one.")

    # Issue 1
    add_h1(doc, "Issue 1: Landlord's Duty to Mitigate Damages")
    add_h2(doc, "Your analysis:")
    add_shaded_block(doc,
        "The two-year lease term for a $1,200 monthly payment was created between Carla and the "
        "tenant. Carla will not be entitled to the 12 months of unpaid rent from the tenant because "
        "Carla had the opportunity to re-rent the premises for the equal amount on three different "
        "occasions. Therefore, Carla failed to mitigate her damages, Carla would only be entitled "
        "to a reasonable extent being the weeks to find a new tenant not months.",
        "FDF6EE")
    add_h2(doc, "Model analysis:")
    add_shaded_block(doc,
        "When a tenant vacates early, the landlord has a duty to make reasonable efforts to re-let "
        "the premises. Carla had three opportunities to re-rent the house at the same $1,200 "
        "monthly rate but declined each one. Because suitable replacement tenants were available "
        "and Carla took no action to re-let, she failed to exercise reasonable diligence. Her "
        "recoverable damages are limited to the rent lost during the period it would have "
        "reasonably taken to find a new tenant -- likely a matter of weeks, given that three "
        "qualified prospects came to her -- plus any reasonable costs of re-letting.",
        "EEF5EE")
    add_body(doc,
        "You reached the right conclusion -- Carla cannot recover all 12 months. But your "
        "analysis skips the key step: why did she fail to mitigate? You said she \"had "
        "the opportunity\" but did not explain what reasonable diligence looks like or why turning "
        "down three qualified tenants falls short of it. The model walks through the standard "
        "(reasonable efforts to re-let), applies the specific facts (three opportunities at equal "
        "rent, all declined), and explains the consequence (damages limited to the reasonable "
        "re-letting period). Each step earns separate points.")
    add_action_box(doc,
        "Build this habit: When you write that someone \"failed\" a legal standard, "
        "explain what they should have done and what they actually did. \"Carla should have "
        "re-let the premises, but she turned down three tenants willing to pay the same rent\" "
        "-- that is the analysis.")

    # Issue 2
    add_h1(doc, "Issue 2: Co-tenant's Right to Share Rental Income")
    add_h2(doc, "Your analysis:")
    add_shaded_block(doc,
        "Joint tenants with rights of survivorship holding a property are entitled to equal "
        "shares amongst each other to use the property for their own enjoyment and to obtain "
        "payment should property create an income. Here, Alonzo and Barbara are entitled to a "
        "share of the rental income that is payable to Carla under the lease because the tenancy "
        "allows for the holders to receive equal shares of any and all to do with the property.",
        "FDF6EE")
    add_h2(doc, "Model analysis:")
    add_shaded_block(doc,
        "When a co-tenant in possession collects rent from a third-party tenant, she must account "
        "to the other co-tenants for their proportionate share of the net rental income. Carla "
        "leased the property to a tenant at $1,200 per month. As one of three equal joint tenants, "
        "Carla must account to Alonzo and Barbara for two-thirds of the net rent collected. Each "
        "co-tenant is entitled to one-third. Carla's right to lease the property as a co-tenant "
        "in possession does not eliminate her obligation to share the proceeds.",
        "EEF5EE")
    add_body(doc,
        "You reached the right conclusion but your reasoning is circular: you said they are "
        "entitled to a share \"because the tenancy allows for equal shares.\" That restates the "
        "conclusion as the reason. The model names the specific doctrine -- a co-tenant in "
        "possession who collects third-party rent must account to the others -- then "
        "applies it by calculating shares (one-third each). Graders award points for the specific "
        "rule and the specific math, not for the general principle of equality.")
    add_action_box(doc,
        "Build this habit: If your \"because\" clause just restates your conclusion in "
        "different words, it is not analysis. Ask yourself: could a reader who does not know "
        "the law follow my reasoning from the facts to the conclusion? If not, you need to name "
        "the specific doctrine and show the specific calculation.")

    # Issue 3
    add_h1(doc, "Issue 3: Fair Rental Value and Ouster")
    add_h2(doc, "Your analysis:")
    add_shaded_block(doc,
        "After Carla moved into the house, she is not required to pay the fair rental value of "
        "$1,500 per month because she occupied the property as Alonzo and Barbara are permitted "
        "to occupy the property. An ouster has not occurred per the facts, therefore, all tenants "
        "are able to occupy the property equally.",
        "FDF6EE")
    add_h2(doc, "Model analysis:")
    add_shaded_block(doc,
        "A co-tenant in sole possession generally has no obligation to pay fair rental value "
        "to the other co-tenants, because each co-tenant has an equal right to possess the "
        "entire property. This changes only if an ouster occurs -- meaning the co-tenant in "
        "possession denies the others the right to enter or use the property. Here, the facts "
        "do not indicate that Carla locked Alonzo and Barbara out, refused them access, or "
        "otherwise denied their right to co-occupy. Without an ouster, Carla owes nothing for "
        "her sole possession.",
        "EEF5EE")
    add_body(doc,
        "You stated the right conclusion twice -- no ouster, no rent owed -- but never defined "
        "what ouster actually is. The model defines it (denying the other co-tenants the "
        "right to enter or use the property), then walks through the facts to show it did not "
        "happen (no lockout, no refusal of access). Your essay says \"an ouster has not occurred "
        "per the facts\" without explaining which facts you examined or what you were looking for. "
        "A grader reading your version cannot tell if you know the ouster doctrine or just guessed.")
    add_action_box(doc,
        "Build this habit: Before saying something did not happen, define what it "
        "would look like if it did. \"Ouster means one co-tenant denies the others access. "
        "Here, nothing suggests Carla prevented Alonzo or Barbara from entering the house.\" Now "
        "the grader knows you understand the doctrine, not just the answer.")

    # Issue 4
    add_h1(doc, "Issue 4: Whether a Lease Severs a Joint Tenancy")
    add_h2(doc, "Your analysis:")
    add_shaded_block(doc,
        "A JTWROS does not sever by leasing a property to a tenant, the ownership interests "
        "remain the same. The only way to sever is by transferring their interest during their "
        "lifetime not in their will after death. The leasing of the property to the tenant did "
        "not sever the relationship between the three children and did not create any effect "
        "following her death.",
        "FDF6EE")
    add_h2(doc, "Model analysis:")
    add_shaded_block(doc,
        "The critical question is whether Carla's lease to the tenant severed her joint tenancy "
        "interest. Severance requires the destruction of one of the four unities (time, title, "
        "interest, possession). In the majority of jurisdictions, a lease grants a temporary "
        "possessory interest but does not permanently destroy the unity of interest or title, "
        "so it does not sever the joint tenancy. Some jurisdictions hold that a lease temporarily "
        "disrupts unity of possession, creating a partial severance during the lease term. Under "
        "the majority rule, which this prompt likely tests, the joint tenancy survived. Therefore, "
        "when Carla died, her interest passed by right of survivorship to Alonzo and Barbara "
        "-- her attempted devise to her son in her will had no effect.",
        "EEF5EE")
    add_body(doc,
        "This is the most important issue on the prompt, and your analysis did not engage with "
        "the core question. You stated that a lease does not sever -- but this is exactly what the "
        "question is asking you to analyze, not assume. The model explains why: a lease "
        "is a temporary possessory interest that does not destroy the four unities required for a "
        "joint tenancy. It also acknowledges the minority view (some courts find partial "
        "severance), which shows the grader you understand this is a contested area. On the bar "
        "exam, treating a debatable point as settled is the single fastest way to lose points.")
    add_action_box(doc,
        "Build this habit: When a question asks \"what effect, if any\" -- that is a "
        "signal that the answer is genuinely debatable. State both sides. \"Under the majority "
        "rule, no severance because... Under the minority rule, possible severance because...\" "
        "Then pick a side and conclude. Showing both views earns more points than asserting one.")

    # Conclusory vs Proper
    add_h1(doc, "Conclusory Analysis vs. Proper Analysis")
    add_body(doc,
        "Below are specific sentences from your essay rewritten to show the difference. The "
        "conclusory version states the outcome. The rewritten version explains why the "
        "facts lead there.")

    add_h2(doc, "Duty to mitigate")
    add_rewrite_pair(doc,
        "Carla failed to mitigate her damages, Carla would only be entitled to a reasonable "
        "extent being the weeks to find a new tenant not months.",
        "Carla failed to mitigate because she turned down three tenants willing to pay the same "
        "$1,200 rent. Her recoverable damages are limited to the weeks it would have reasonably "
        "taken to re-let, not the remaining 12 months.")

    add_h2(doc, "Co-tenant rental accounting")
    add_rewrite_pair(doc,
        "Alonzo and Barbara are entitled to a share of the rental income because the tenancy "
        "allows for the holders to receive equal shares of any and all to do with the property.",
        "Carla collected $1,200 per month from a third-party tenant, so she must account to "
        "Alonzo and Barbara for their share. As equal one-third joint tenants, each is entitled "
        "to $400 per month.")

    add_h2(doc, "Ouster")
    add_rewrite_pair(doc,
        "An ouster has not occurred per the facts, therefore, all tenants are able to occupy "
        "the property equally and fairly without paying either tenants.",
        "Ouster requires one co-tenant to deny the others access. Nothing suggests Carla locked "
        "Alonzo or Barbara out, so no ouster occurred and Carla owes no fair rental value.")

    add_h2(doc, "Severance by lease")
    add_rewrite_pair(doc,
        "A JTWROS does not sever by leasing a property to a tenant, the ownership interests "
        "remain the same.",
        "Severance requires destroying one of the four unities. A lease transfers temporary "
        "possession but does not destroy unity of title or interest. Because the joint tenancy "
        "survived, Carla's interest passed to Alonzo and Barbara by survivorship at her death.")

    # Closing
    add_body(doc,
        "You spotted most of the right issues and your instincts are sound -- you generally reach "
        "the correct outcome. The consistent pattern is that you state conclusions without the "
        "reasoning that earns the points: (1) define the standard before applying it; (2) when "
        "you say someone \"failed,\" explain what they should have done; (3) when a question "
        "says \"if any,\" treat it as debatable and show both sides; (4) replace circular "
        "reasoning with specific facts and specific calculations.")
    add_footer(doc, "Bar Prep by SHEP  |  May 14, 2026")

    path = os.path.join(OUTPUT_DIR, "Intesar_Real-Property_Analysis.docx")
    doc.save(path)
    return path


if __name__ == "__main__":
    p1 = build_business_associations()
    print(f"Business Associations: {p1}")
    p2 = build_real_property()
    print(f"Real Property: {p2}")
