/**
 * Login View Data Builder
 *
 * Transforms LoginPageDTO into ViewData for the login template.
 * Deterministic, side-effect free, no business logic.
 */

import { LoginPageDTO } from '@/lib/services/auth/types/LoginPageDTO';
import { LoginViewData } from './types/LoginViewData';

export class LoginViewDataBuilder {
  static build(apiDto: LoginPageDTO): LoginViewData {
    return {
      returnTo: apiDto.returnTo,
      hasInsufficientPermissions: apiDto.hasInsufficientPermissions,
      showPassword: false,
      showErrorDetails: false,
      formState: {
        fields: {
          email: { value: '', error: undefined, touched: false, validating: false },
          password: { value: '', error: undefined, touched: false, validating: false },
          rememberMe: { value: false, error: undefined, touched: false, validating: false },
        },
        isValid: true,
        isSubmitting: false,
        submitError: undefined,
        submitCount: 0,
      },
      isSubmitting: false,
      submitError: undefined,
    };
  }
}