export type OnboardingStepKey =
  | 'basics'
  | 'localization'
  | 'plan-limits'
  | 'admin-user';

export interface OnboardingStepDefinition {
  readonly key: OnboardingStepKey;
  readonly label: string;
}

export interface OnboardingLookupValue {
  readonly id: string;
  readonly label: string;
  readonly secondaryLabel?: string | null;
}

export interface CountryLookupValue extends OnboardingLookupValue {
  readonly iso2?: string | null;
}

export interface OrganizationBasicsValue {
  readonly organizationCode: string | null;
  readonly organizationName: string;
  readonly shortName: string;
  readonly localLanguageName: string | null;
  readonly organizationType: OnboardingLookupValue;
  readonly industry: OnboardingLookupValue;
  readonly registrationCountry: CountryLookupValue;
}

export type TimeFormatValue = 'TwelveHour' | 'TwentyFourHour';

export type DateFormatValue =
  | 'DD/MM/YYYY'
  | 'MM/DD/YYYY'
  | 'YYYY-MM-DD';

export type NumberFormatValue =
  | 'OneTwoThreeCommaFourFiveSixPointSevenEight'
  | 'OneTwoThreePointFourFiveSixCommaSevenEight';

export type FiscalYearConventionValue =
  | 'CalendarYear'
  | 'AprilToMarch'
  | 'JulyToJune';

export interface OrganizationLocalizationValue {
  readonly timeZone: OnboardingLookupValue;
  readonly currency: OnboardingLookupValue;
  readonly defaultLanguage: OnboardingLookupValue;
  readonly additionalLanguageIds: readonly string[];
  readonly additionalLanguageSelections: readonly OnboardingLookupValue[];
  readonly dateFormat: DateFormatValue;
  readonly timeFormat: TimeFormatValue;
  readonly numberFormat: NumberFormatValue;
  readonly fiscalYearConvention: FiscalYearConventionValue;
  readonly localizationDefaultsCountryId: string | null;
}

export type OrganizationLicenseType = 'Trial' | 'Paid';

export interface OrganizationPlanLookupValue extends OnboardingLookupValue {
  readonly code?: string | null;
}

export interface OrganizationPlanLimitsValue {
  readonly subscriptionPlan: OrganizationPlanLookupValue;
  readonly licenseType: OrganizationLicenseType;
  readonly maximumCompanies: number;
  readonly maximumUsers: number;
  readonly maximumStorageGb: number;
  readonly goLiveDate: string;
  readonly systemAccessStartDate: string;
  readonly systemAccessEndDate: string | null;
  readonly limitsEditable: boolean;
}

export interface OrganizationAdminValue {
  readonly organizationEmail: string;
  readonly organizationPhone: string;
  readonly administratorFullName: string;
  readonly administratorEmail: string;
  readonly administratorMobile: string;
}

export interface OrganizationOnboardingData {
  readonly basics: OrganizationBasicsValue | null;
  readonly localization: OrganizationLocalizationValue | null;
  readonly planLimits: OrganizationPlanLimitsValue | null;
  readonly admin: OrganizationAdminValue | null;
}

export interface CountryLocalizationDefaults {
  readonly countryId: string;
  readonly timeZone: OnboardingLookupValue;
  readonly currency: OnboardingLookupValue;
  readonly defaultLanguage: OnboardingLookupValue;
  readonly dateFormat: DateFormatValue;
  readonly timeFormat: TimeFormatValue;
  readonly numberFormat: NumberFormatValue;
  readonly fiscalYearConvention: FiscalYearConventionValue;
}

export interface OrganizationPlanDefaults {
  readonly plan: OrganizationPlanLookupValue;
  readonly licenseType: OrganizationLicenseType;
  readonly maximumCompanies: number;
  readonly maximumUsers: number;
  readonly maximumStorageGb: number;
  readonly limitsEditable: boolean;
}

export interface OnboardingStepForm<TValue> {
  validate(): boolean;
  getValue(): TValue;
  getDraftValue(): Partial<TValue>;
  patchValue(value: Partial<TValue>): void;
}