package organization

import (
	"github.com/gofiber/fiber/v2"
	"lms.de/backend/modules/database"
	"lms.de/backend/modules/structs"
)

func GetOrganizationSettings(c *fiber.Ctx) error {
	// swagger:operation GET /organization/settings organization getOrganizationSettings
	// ---
	// summary: Get settings
	// consumes:
	// - application/json
	// produces:
	// - application/json
	// responses:
	//   '200':
	//     description: Settings fetched successfully
	//     schema:
	//       "$ref": "#/definitions/GetOrganizationSettingsResponse"
	//   '400':
	//     description: Invalid request body
	//   '500':
	//     description: Failed to fetch settings

	var organizationSettings structs.GetOrganizationSettingsResponse

	database.DB.Model(&structs.Organization{}).Select("subdomain", "company_name", "primary_color", "logo_url", "banner_url").First(&organizationSettings)

	return c.JSON(organizationSettings)
}
