import { br as limitsLengthFilialFields } from "./index-DfebxkL9.js";
import { u as unionType, o as objectType, n as numberType, s as stringType, l as literalType, b as booleanType } from "./types-espwwxTQ.js";
const quotaLinkRegex = /https?:\/\/([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}\/(roles|docs|common|shared-to-me|shared-access|favorites|rooms|profile)(?:\/\d+)?/;
const createQuotaRelationScheme = (t) => objectType({
  NewQuota: literalType(true),
  Url: stringType().min(1, {
    message: t("filials.diskSpace.pastUrl")
  }).regex(quotaLinkRegex, {
    message: t("quota.errors.wrongLink")
  }),
  Quota: objectType({
    Name: stringType().trim().min(1, {
      message: t("validation.required")
    }).max(64, {
      message: t("validation.maxLengthSymbolsWithCount.symbols", {
        count: 64
      })
    }),
    Size: numberType({
      required_error: t("filials.diskSpace.errors.size"),
      invalid_type_error: t("filials.diskSpace.errors.type")
    }).max(1e3, {
      message: t("filials.diskSpace.errors.max")
    }).positive({
      message: t("filials.diskSpace.errors.positive")
    }).safe()
  })
});
const useQuotaRelationScheme = (t) => objectType({
  NewQuota: literalType(false),
  Url: stringType().min(1, {
    message: t("filials.diskSpace.pastUrl")
  }).regex(quotaLinkRegex, {
    message: t("quota.errors.wrongLink")
  }),
  QuotaId: numberType({
    invalid_type_error: t("validation.quotaMandatory")
  })
});
const validateQuotaRelationScheme = (t) => unionType([createQuotaRelationScheme(t), useQuotaRelationScheme(t)]);
const settingsPageValidateScheme = (t) => objectType({
  Title: stringType().max(limitsLengthFilialFields.Title, {
    message: t("validation.maxLengthSymbolsWithCount.symbols", {
      count: limitsLengthFilialFields.Title
    })
  }).refine((value) => value.trim().length > 0, {
    message: t("validation.emptyInput")
  }).refine((value) => value.length > 0, {
    message: t("validation.enterFilialName")
  }),
  Company: stringType().max(limitsLengthFilialFields.Company, {
    message: t("validation.maxLengthSymbolsWithCount.symbols", {
      count: limitsLengthFilialFields.Company
    })
  }).refine((value) => value.trim().length > 0, {
    message: t("validation.emptyInput")
  }).refine((value) => value.length > 0, {
    message: t("validation.required")
  }).or(literalType("")),
  IsParentSettings: booleanType()
});
const createFilialSchema = (t) => objectType({
  Company: stringType().max(limitsLengthFilialFields.Company, {
    message: t("validation.maxLengthSymbolsWithCount.symbols", {
      count: limitsLengthFilialFields.Company
    })
  }).nullable(),
  Title: stringType().min(1, {
    message: t("filials.isRequiredField")
  }).max(limitsLengthFilialFields.Title, {
    message: t("validation.maxLengthSymbolsWithCount.symbols", {
      count: limitsLengthFilialFields.Title
    })
  }).refine((value) => value.trim().length > 0, {
    message: t("validation.emptyInput")
  }),
  Parent: objectType({
    Id: numberType({
      invalid_type_error: t("filials.isRequiredField")
    })
  })
});
export {
  createFilialSchema as c,
  settingsPageValidateScheme as s,
  validateQuotaRelationScheme as v
};
//# sourceMappingURL=validate-CA6bwF22.js.map
