# frozen_string_literal: true

module SnailMail
  module Components
    module Templates
      class <%= @class_name %> < <%= @base_class %>
        def self.template_name
          "<%= @template_name %>"
        end

        def self.template_description
          "<%= @description %>"
        end

        def self.show_on_single?
          true
        end

<% if @base_class == "HalfLetterComponent" %>
        def self.template_size
          :<%= @size %>
        end

        def render_front
          # Add your front side template content here
          font "arial" do
            text_box "Hello from <%= @template_name %>!", 
              size: 24, 
              at: [0, bounds.top - 50], 
              valign: :center, 
              align: :center
          end
        end

        def render_back
          # Add your back side template content here (optional)
        end
<% else %>
        def view_template
          # Add your template content here
          
          # Example: Add an image
          # image(
          #   image_path("your-image.png"),
          #   at: [x, y],
          #   width: width,
          # )

          # Render return address
          render_return_address(10, 278, 260, 70, size: 10)

          # Render destination address
          render_destination_address(
            88,
            166,
            236,
            71,
            size: 16, 
            valign: :bottom, 
            align: :left
          )

          # Render postal elements
          render_imb(240, 24, 183)
          render_qr_code(5, 65, 60)
          render_letter_id(10, 19, 10)
          render_postage
        end
<% end %>
      end
    end
  end
end
