-- Cards.lua - texture path resolution for card art.
local ADDON, ns = ...
local Cards = ns.Cards

local CARD_DIR = "Interface\\AddOns\\" .. ADDON .. "\\Textures\\Cards\\"

-- Returns the texture path for a card code ("AS", "10H", ...).
-- The ".tga" extension is included explicitly: WoW's texture loader resolves
-- custom TGA art reliably when the extension is present.
function Cards.Path(code)
    return CARD_DIR .. code .. ".tga"
end

function Cards.BackPath()
    return CARD_DIR .. "back.tga"
end

-- Card display aspect ratio is 1:2 (matches generated 256x512 art).
Cards.ASPECT = 0.5

-- Apply a card (or the back, if code is nil) to a Texture object.
function Cards.Apply(texture, code)
    if code then
        texture:SetTexture(Cards.Path(code))
    else
        texture:SetTexture(Cards.BackPath())
    end
end
