module ExcelReports
  module VideoReports
    module NatGeoLegalBinderLogs
      class LegalBinderChecklistSheet < Worksheet
        def title
          "Legal Binder Checklist"
        end

        def fill_content(sheet)
          sheet.add_row ["SERIES TITLE:", ""]
          sheet.add_row ["EPISODE NUMBER:", header_data.number]
          sheet.add_row ["EPISODE TITLE:", header_data.name]
          sheet.add_row
          sheet.add_row
          sheet.add_row ["", "INCLUDED", "PENDING", "N/A", "COMMENTS"]
          sheet.add_row ["COPY OF CREDIT LIST", "", "", "", ""]
          sheet.add_row ["COPY OF MUSIC CUE SHEET", "", "", "", ""]
          sheet.add_row ["COPY OF E&O CERTIFICATE", "", "", "", ""]
          sheet.add_row ["APPEARANCE RELEASES + LOG", "", "", "", ""]
          sheet.add_row ["LOCATION RELEASES/PERMITS + LOG", "", "", "", ""]
          sheet.add_row ["ACQUIRED FOOTAGE/STILLS CONTRACTS + LOG", "", "", "", ""]
          sheet.add_row ["THIRD PARTY CONTRACTS (GRAPHICS, COMPOSER, MUSIC LIBRARY, NARRATOR, TALENT) + LOG", "", "", "", ""]
          sheet.add_row ["PRODUCTION PERSONNEL LOG", "", "", "", ""]
        end

        def format(sheet)
          sheet.column_widths *column_widths
          cells_to_merge.each { |cell| sheet.merge_cells cell }
        end
        
        def style(sheet)
          sheet.add_style "A1:A3", Styles::BOLD, { sz: 14 }
          sheet.add_style "B6:E6", Styles::BOLD, Styles::THIN_BLACK_BORDER, Styles::FULLY_CENTERED, { sz: 10 }
          sheet.add_style "A7:A14", Styles::BOLD, Styles::THIN_BLACK_BORDER, Styles::WRAP_TEXT, { sz: 10 }
          sheet.add_style "B7:E14", Styles::THIN_BLACK_BORDER
        end

        private

        def column_widths
          [30, 12, 12, 10, 25]
        end

        def cells_to_merge
          %w(B1:D1 B2:D2 B3:D3)
        end
      end
    end
  end
end
